Skip to content

Instantly share code, notes, and snippets.

@mattmattox
Last active July 12, 2022 15:37
Show Gist options
  • Save mattmattox/4b82f043c317f7e080941f8dd4d6c0c4 to your computer and use it in GitHub Desktop.
Save mattmattox/4b82f043c317f7e080941f8dd4d6c0c4 to your computer and use it in GitHub Desktop.
Example slack alert for alertmanager
...
config:
global:
resolve_timeout: 5m
slack_api_url: "https://hooks.slack.com/services/abcdef/123456789...."
receivers:
- name: "slack"
slack_configs:
- api_url: 'https://hooks.slack.com/services/abcdef/123456789....'
username: 'ClusterName'
channel: '#monitoring'
send_resolved: true
color: '{{ if eq .Status "firing" }}danger{{ else }}good{{ end }}'
title: "[{{ .Status | toUpper }}] {{ range .Alerts }}{{ .Annotations.summary }}\n{{ end }}"
text: |-
{{ range .Alerts }}*Description:* {{ .Annotations.description }}
*Cluster:* ClusterName
*Severity:* {{ .Labels.severity }}
{{ end }}
fallback: '{{ template "slack.default.fallback" . }}'
icon_emoji: '{{ template "slack.default.iconemoji" . }}'
icon_url: '{{ template "slack.default.iconurl" . }}'
route:
group_by:
- job
group_interval: 5m
group_wait: 30s
receiver: "slack"
repeat_interval: 12h
routes: []
templates:
- '/etc/alertmanager/config/*.tmpl'
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment