Slack#
Alertmanager 内置 slack_configs,可以直接对接 Slack Incoming Webhook。
1. API / Webhook#
Slack Incoming Webhook:
https://hooks.slack.com/services/xxx/yyy/zzzdocs:
- https://api.slack.com/messaging/webhooks
- https://prometheus.io/docs/alerting/latest/configuration/#slack_config
2. Alertmanager Config#
global:
slack_api_url: ${SLACK_WEBHOOK_URL}
route:
receiver: slack-platform
receivers:
- name: slack-platform
slack_configs:
- channel: "#alerts"
send_resolved: true
title: '{{ template "alert.title" . }}'
text: '{{ template "alert.text" . }}'3. Notes#
Best Practice:
webhook url 使用 Secret 管理
critical 告警可以单独发到 #alerts-critical
普通 warning 可以发到 team channel