落烨无痕

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

配置alertmanager的时候,都是根据网上的教程来配置的。

因为我是用QQ邮箱来发送告警的,所以alertmanager.yml的邮箱配置如下:

global:
resolve_timeout: 5m
smtp_smarthost: 'smtp.qq.com:465'
smtp_from: 'xxxxxx@qq.com'
smtp_auth_username: 'xxxxxx@qq.com'
smtp_auth_password: 'xxxxxxxxxx'
smtp_require_tls: false

 

注意事项:

1.需要先登录QQ邮箱,开通smtp功能,并获取授权码。smtp_auth_password填写的信息,就是授权码,而非QQ邮箱的登录密码

 

 2.smtp.qq.com:465 ,端口使用465。其他资料说用587端口也可以。(如果是云服务器,25端口通常是被服务商封闭的,所有也不能使用25端口)

 报错信息:

msg="Notify for alerts failed" num_alerts=1 err="*notify.loginAuth failed: 530 Must issue a STARTTLS command first."

 

3.smtp_require_tls: false 必须加上,因为smtp_require_tls默认为true。

 

alertmanager主要处理流程(引用:https://www.kancloud.cn/huyipow/prometheus/527563,对alertmanager做了很全面到位的解释)

  1. 接收到Alert,根据labels判断属于哪些Route(可存在多个Route,一个Route有多个Group,一个Group有多个Alert)
  2. 将Alert分配到Group中,没有则新建Group
  3. 新的Group等待group_wait指定的时间(等待时可能收到同一Group的Alert),根据resolve_timeout判断Alert是否解决,然后发送通知
  4. 已有的Group等待group_interval指定的时间,判断Alert是否解决,当上次发送通知到现在的间隔大于repeat_interval或者Group有更新时会发送通知
posted on 2019-06-27 16:12  落烨无痕  阅读(8533)  评论(0编辑  收藏  举报