open-falcon实现邮件报警

1.请安装好Go的环境,参考上一篇open-falcon的安装博文git

2.安装 mail-providergithub

https://github.com/open-falcon/mail-provider

安装方法express

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文件相关信息,使用json

./control start

 在cfg.json里面使用的163邮箱的smtp服务,须要开启客户端受权码,若是提示:发送数量超过配额,请过24小时再请求手机验证码bash

 

使用curl命令,验证是否能发邮件,返回success的话就是成功了curl

curl http://127.0.0.1:4000/sender/mail -d "tos=你的邮箱&subject=报警测试&content=这是一封测试邮件"
success

 

3.安装 senderide

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中的配置改为ui

 "mail": "http://127.0.0.1:4000/sender/mail"

 4.在open-falcon的portal的expression中配置报警表达式,以下图url

记住配置报警接受人的组,这决定了谁的邮箱将会收到报警

5.模拟报警环境,而后将会收到邮件,同时在alarm-dashboard中也能看到报警

相关文章
相关标签/搜索