Alertmanager 发送通知

最后更新于:2022-04-02 03:00:28

[TOC] > [github alertmanager](https://github.com/prometheus/alertmanager) ## Alertmanager 发送通知 ### 安装 Alertmanager ``` &7 wget https://github.com/prometheus/alertmanager/releases/download/v0.15.2/alertmanager-0.15.2.linux-amd64.tar.gz \ && tar xvfz alertmanager-0.15.2.linux-amd64.tar.gz \ && cd alertmanager-0.15.2.linux-amd64 \ && ./alertmanager ``` 查看 `http://192.168.0.229:9093/` ### 设置 alertmanager.yml 设置 alertmanager 命令的 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'] ``` - route 块表示通知路由,可以根据不同的标签将告警通知发送给不同的 receiver - 这里没有配置 routes 项,表示所有的告警都发送给下面定义的 web.hook 这个 receiver 多路由配置: ``` routes: - receiver: 'database-pager' group_wait: 10s match_re: service: mysql|cassandra - receiver: 'frontend-pager' group_by: [product, environment] match: team: frontend ```
';