目录
在promethes和alertmanager启动的时候,都加上--web.external-url
就可以了
./prometheus --config.file=prometheus.yml --web.external-url=http://x.x.x.x:9090
./alertmanager --config.file=alertmanager.yml --web.external-url=http://x.x.x.x:9093
回到顶部
【1】alertmanager webhook 内容
(1)alertmanager.yml 配置
global: resolve_timeout: 5m route: group_by: ['alertname'] group_wait: 10s group_interval: 10s repeat_interval: 1h receiver: 'web.hook' receivers: - name: 'web.hook' webhook_configs: - url: 'http://127.0.0.1:5001/' inhibit_rules: - source_match: severity: 'critical' target_match: severity: 'warning' equal: ['alertname', 'dev', 'instance']
(2)发送给 webhook 的 内容为json串
其实 alertmanager发给webhook 以及其他接收者的信息是一个 json 串。
{ "receiver":"webhook", "status":"resolved", "alerts":[ { "status":"resolved", "labels":{ "alertname":"hostCpuUsageAlert", "instance":"192.168.199.24:9100", "severity":"page" }, "annotations":{ "description":"192.168.199.24:9100 CPU 使用率超过 85% (当前值为: 0.9973333333333395)", "summary":"机器 192.168.199.24:9100 CPU 使用率过高" }, "startsAt":"2020-02-29T19:45:21.799548092+08:00", "endsAt":"2020-02-29T19:49:21.799548092+08:00", "generatorURL":"http://localhost.localdomain:9090/graph?g0.expr=sum+by%28instance%29+%28avg+without%28cpu%29+%28irate%28node_cpu_seconds_total%7Bmode%21%3D%22idle%22%7D%5B5m%5D%29%29%29+%3E+0.85&g0.tab=1", "fingerprint":"368e9616d542ab48" } ], "groupLabels":{ "alertname":"hostCpuUsageAlert" }, "commonLabels":{ "alertname":"hostCpuUsageAlert", "instance":"192.168.199.24:9100", "severity":"page" }, "commonAnnotations":{ "description":"192.168.199.24:9100 CPU 使用率超过 85% (当前值为: 0.9973333333333395)", "summary":"机器 192.168.199.24:9100 CPU 使用率过高" }, "externalURL":"http://localhost.localdomain:9093", "version":"4", "groupKey":"{}:{alertname="hostCpuUsageAlert"}" }标签:Alertmanager,alermanager,webhook,192.168,alertmanager,9100,alertname,199.24 From: https://www.cnblogs.com/cheyunhua/p/18392685