我有2个服务A and B我想监控。我还有 2 个不同的通知渠道X and Y形式为receivers
在 AlertManager 配置文件中。
我想发送通知X如果服务A出现故障并想要通知Y如果服务B下跌降落。我怎样才能实现这个我的配置?
我的 AlertManager YAML 文件是:
route:
receiver: X
receivers:
- name: X
email_configs:
- name: Y
email_configs:
And alert.rule
文件是:
groups:
- name: A
rules:
- alert: A_down
expr: expression
for: 1m
labels:
severity: critical
annotations:
summary: "A is down"
- name: B
rules:
- alert: B_down
expr: expression
for: 1m
labels:
severity: warning
annotations:
summary: "B is down"
配置应该大致如下(未经测试):
route:
group_wait: 30s
group_interval: 5m
repeat_interval: 2h
receiver: 'default-receiver'
routes:
- match:
alertname: A_down
receiver: X
- match:
alertname: B_down
receiver: Y
The idea is, that each [`route`](https://prometheus.io/docs/alerting/configuration/#%3Croute%3E) field can has a `routes` field, where you can put a different config, that gets enabled if the labels in `match` match the condition.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)