alertmanager 告警路由
概述
Alertmanager 的 route 配置支持定义 树 状路由表,入口位置称为根节点, 每个字节点可以基于匹配条件定义出一个独立的路由分支。
所有的告警都将从路由根节点,而后进行子节点遍历。
若路由上的 continue 字段为 false, 则遇到第一个匹配的路由分支后即停止匹配, 否则将继续匹配后续的节点。
配置文件
route: # 路由组 group_by: ['alertname', 'app'] # group_wait: 30s group_interval: 40s repeat_interval: 1m smtp_auth_password: 'IZBJNCRVBAHLMAAB' # 认证秘钥 smtp_require_tls: false # 不启用 ssl templates: - './template/alertmanager-email.tmpl' route: # 路由组 group_by: ['alertname', 'app'] # group_wait: 30s group_interval: 40s repeat_interval: 1m receiver: email-receiver # 默认组 routes: - match_re: job: nodes continue: false receiver: email-receiver continue: false routes: - match_re: app: nginx receiver: web_team continue: false - match_re: app: mysql receiver: db_team continue: false receivers: # 收件人组 - name: 'email-receiver' email_configs: - to: 'aaa@sina.com' # 收件人地址 send_resolved: true - name: 'web_team' email_configs: - to: 'xx@qq.com' send_resolved: true # #是否通知已解决的警报。 - name: 'db_team' email_configs: - to: 'xx@aliyun.com' send_resolved: true # #是否通知已解决的警报。 inhibit_rules: - source_match: severity: 'critical' target_match_re: severity: '.*' equal: ['instance']
效果演示
app=mysql
app=nginx
作者:闫世成
出处:http://cnblogs.com/yanshicheng
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。如有问题或建议,请联系上述邮箱,非常感谢。