open-falcon实现邮件报警
2024-10-19 16:33:22
1.请安装好Go的环境,参考上一篇open-falcon的安装博文
2.安装 mail-provider
https://github.com/open-falcon/mail-provider
安装方法
cd $GOPATH/src
mkdir github.com/open-falcon/ -p
cd github.com/open-falcon/
git clone https://github.com/open-falcon/mail-provider.git
cd mail-provider
go get ./...
./control build
编译成功之后,修改cfg.json文件相关信息,使用
./control start
在cfg.json里面使用的163邮箱的smtp服务,需要开启客户端授权码,如果提示:发送数量超过配额,请过24小时再请求手机验证码
使用curl命令,验证是否能发邮件,返回success的话就是成功了
curl http://127.0.0.1:4000/sender/mail -d "tos=你的邮箱&subject=报警测试&content=这是一封测试邮件"
success
3.安装 sender
https://github.com/open-falcon-archive/sender
编译和安装
# set $GOPATH and $GOROOT
mkdir -p $GOPATH/src/github.com/open-falcon
cd $GOPATH/src/github.com/open-falcon
git clone https://github.com/open-falcon/sender.git
cd sender
go get ./...
./control build
# vi cfg.json modify configuration
./control start
将cfg.json中的配置改成
"mail": "http://127.0.0.1:4000/sender/mail"
4.在open-falcon的portal的expression中配置报警表达式,如下图
记住配置报警接受人的组,这决定了谁的邮箱将会收到报警
5.模拟报警环境,然后将会收到邮件,同时在alarm-dashboard中也能看到报警
最新文章
- POJ 3009 Curling 2.0【带回溯DFS】
- 辛巴学院-Unity-剑英陪你零基础学c#系列(三)计算与类型
- JDK在Linux系统上安装教程
- Fluent API 配置
- RT-Thread多线程导致的临界区问题
- [翻译] 使用ASP.NET MVC操作过滤器记录日志
- GHOST出错
- [转载]java NIO详解
- 安卓RadioButton的使用
- cocos2d-x中使用JNI的调用JAVA方法
- DEV GridView嵌套
- Spark-GraphxAPI学习笔记
- iOS开发——NSArray中的字典排序
- linux_文件类型
- Codeforce C. Bus
- R语言︱情感分析—词典型代码实践(最基础)(一)
- Django项目实践4 - Django站点管理(后台管理员)
- C#默认参数原理探究
- Elasticsearch-6.7.0系列(三)5601端口 kibana——ES的UI界面
- 计算机网络--HTTP协议