prometheus/gmp/alertmanager.yaml (45 lines of code) (raw):

global: resolve_timeout: 1m route: receiver: 'slack-notifications' group_by: [alertname, job, app] receivers: - name: 'slack-notifications' slack_configs: - api_url: SLACK_WEBHOOK_URL send_resolved: true title: | [{{ .Status | toUpper -}} {{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{- end -}} ] {{ .CommonLabels.alertname }} text: | {{- if eq .CommonLabels.severity "critical" -}} *Severity:* `Critical` :red_circle: {{- else if eq .CommonLabels.severity "warning" -}} *Severity:* `Warning` :warning: {{- else if eq .CommonLabels.severity "info" -}} *Severity:* `Info` :information_source: {{- else -}} *Severity:* `Unknown` :interrobang: {{ .CommonLabels.severity }} {{- end }} {{- if (index .Alerts 0).Annotations.summary }} {{- "\n" -}} *Summary:* {{ (index .Alerts 0).Annotations.summary }} {{- end }} {{- if (index .Alerts 0).Labels.namespace }} {{- "\n" -}} *Namespace:* `{{ (index .Alerts 0).Labels.namespace }}` {{- end }} {{ range .Alerts }} {{- if .Annotations.description }} {{- "\n" -}} {{ .Annotations.description }} {{- "\n" -}} {{- end }} {{- if .Annotations.message }} {{- "\n" -}} {{ .Annotations.message }} {{- "\n" -}} {{- end }} {{- end }} color: '{{ if eq .Status "firing" -}}{{ if eq .CommonLabels.severity "warning" -}}warning{{- else if eq .CommonLabels.severity "critical" -}}danger{{- else -}}#439FE0{{- end -}}{{ else -}}good{{- end }}'