Prometheus 单独定义Alertmanager webhook时,它不起作用
我使用包含电子邮件和webhook的默认接收器配置alertmanager:Prometheus 单独定义Alertmanager webhook时,它不起作用,prometheus,prometheus-alertmanager,Prometheus,Prometheus Alertmanager,我使用包含电子邮件和webhook的默认接收器配置alertmanager: receivers: - name: infra_email email_configs: - to: 'xxx.xxx@xxx.xxx' send_resolved: true webhook_configs: - url: 'http://172.22.45.34:55553/' send_resolved: false 这个很好用 当我尝试将其配置为独立接收器时: r
receivers:
- name: infra_email
email_configs:
- to: 'xxx.xxx@xxx.xxx'
send_resolved: true
webhook_configs:
- url: 'http://172.22.45.34:55553/'
send_resolved: false
这个很好用
当我尝试将其配置为独立接收器时:
route:
receiver: 'infra_email'
group_by: [alertname, severity]
group_interval: 5m
repeat_interval: 4h
group_wait: 3m
routes:
- match:
alertname: ServerRebooted, HostOutOfDiskSpace, HostOutOfMemory
receiver: splunk_webhook
continue: true
receivers:
- name: infra_email
email_configs:
- to: 'xxx.xxx@xxx.xxx'
send_resolved: true
- name: splunk_webhook
webhook_configs:
- url: 'http://172.22.45.34:55553/'
send_resolved: false
这是行不通的。
amtool将路由报告为有效:
# /usr/local/bin/amtool config routes show
Routing tree:
.
└── default-route receiver: infra_email
└── {alertname="ServerRebooted, HostOutOfDiskSpace, HostOutOfMemory} continue: true receiver: splunk_webhook
$ alertmanager --version
alertmanager, version 0.20.0 (branch: HEAD, revision: f74be0400a6243d10bb53812d6fa408ad71ff32d)
build user: root@00c3106655f8
build date: 20191211-14:13:14
go version: go1.13.5
我假设您希望为
服务器重新启动
、主机outofdiskspace
和主机outofmemory
警报调用webhook,并且它们是单独的警报
您的警报与指定的条件不匹配<代码>匹配:对指定的标签进行精确匹配,因此添加逗号无效。
最好的方法是使用match\u re:
,而使用正则表达式:
match_re:
alertname: ServerRebooted|HostOutOfDiskSpace|HostOutOfMemory
P>可选地,您可以考虑向警报本身添加一些标签,然后通过该标签路由警报。如果它们将要splunk的事实是警报本身的一个属性,则您可以在发送到splunk的列表中添加/删除警报,而无需触摸alertmanager配置。是,使用match\u re似乎有效。如果警报匹配,并且有属性continue:true,则不会同时将其发送到默认接收器?