alertmanager+webhook发报警邮件(使用587端口)

alertmanager+webhook发报警邮件(使用587端口):

webhook安装:

go get github.com/prometheus/alertmanager/examples/webhook

启动webhook(默认端口为TCP 5001):

go/bin/webhook

webhookmail.py下载网址(需要手动复制其内容):

https://github.com/youerning/blog/tree/master/prometheus

使用(需要先安装falcon python模块,步骤略):

vi webhookmail.py

改下里面的邮箱配置,smtp端口使用的587,最后的服务端口可以改为5002(默认为80),ip为127.0.0.1(默认为0.0.0.0)

python webhookmail.py

vi alertmanager/alertmanager.yml

调整web.hook的url为http://127.0.0.1:5002/(默认为5001)

启动alertmanager

./alertmanager/alertmanager --config-file=./alertmanager/alertmanager.yml

猜你喜欢

转载自blog.51cto.com/yangzhiming/2415653