altermanager告警分组
promethues里面配置了很多项目监控,不同项目或者不同分组告警信息发送给不同接收人,可以通过配置altermanager来实现。
altermanager部分配置示例
route: receiver: 'default' #默认分组,未匹配到都会发送到此分组 group_wait: 10s group_interval: 1m repeat_interval: 1m group_by: ['alertname'] routes: - receiver: 'op' #标签service为java或者python的告警发送到op分组 group_wait: 10s match_re: service: java|python #match: # service: java inhibit_rules: - source_match: severity: 'critical' target_match: severity: 'warning' equal: ['alertname', 'instance'] receivers: - name: 'default' webhook_configs: - url: 'http://127.0.0.1:8080/prometheus' send_resolved: true - name: 'op' webhook_configs: - url: 'http://127.0.0.1:8081/prometheus' send_resolved: true
prometheus数据采集配置例子 - targets: - 127.0.0.1:8080 labels: group: test module: test service: java 这里的service:java就会被altermanager的op这个路由匹配到,当次主机有告警时就会发送到name为op对应的webhook地址