Customizing alertmanager notifications Tobias Schmidt, @dagrobie, - - PowerPoint PPT Presentation

customizing alertmanager notifications
SMART_READER_LITE
LIVE PREVIEW

Customizing alertmanager notifications Tobias Schmidt, @dagrobie, - - PowerPoint PPT Presentation

Customizing alertmanager notifications Tobias Schmidt, @dagrobie, PromCon 2018 How can I receive nicer Slack notifications from alertmanager? Disable slack. Use a ticketing system. Like Jira. Why tickets? - Keep communication channels


slide-1
SLIDE 1

Customizing alertmanager notifications

Tobias Schmidt, @dagrobie, PromCon 2018

slide-2
SLIDE 2

How can I receive nicer Slack notifications from alertmanager?

slide-3
SLIDE 3

Disable slack. Use a ticketing system. Like Jira.

slide-4
SLIDE 4

Why tickets?

  • Keep communication channels for humans
  • Avoid alerting fatigue by repeated notifications
  • Treat fixing production issues like any other task
  • Scheduling
  • Assignment
  • Track time etc.
  • Ensure every notification is looked into and handled
  • Auto-resolving issues (foo_bar > 2*foo_bar OFFSET 1h)
  • Fix unactionable alerts
  • https://github.com/free/jiralert
slide-5
SLIDE 5

Write your own templates.

slide-6
SLIDE 6

What you need

  • Understand YAML
  • Understand Go templating
  • https://api.slack.com/docs/messages/builder
  • https://prometheus.io/docs/alerting/configuration/
  • Permission to change Alertmanager config
slide-7
SLIDE 7

Example

slide-8
SLIDE 8

alertmanager.yml

receivers:

  • name: prodeng-slack

slack_configs:

  • <next page>

templates:

  • /path/to/templates/*.tmpl
slide-9
SLIDE 9

alertmanager.yml

slack_configs:

  • channel: '#production-engineering'

title: '{{ template "slack.soundcloud.title" . }}' text: '{{ .CommonAnnotations.description }}' footer: '{{ template "slack.soundcloud.survey_footer" . }}' actions:

  • type: button

text: Runbook url: '{{ .CommonAnnotations.runbook_url }}'

fields:

  • title: States

value: '{{ template "slack.soundcloud.alert_states" . }}'

slide-10
SLIDE 10

slack-notification.tmpl

{{ define "slack.soundcloud.title" -}} {{ .GroupLabels.alertname }}: {{ .CommonAnnotations.summary }} {{- end }} {{ define "slack.soundcloud.alert_states" -}} {{ .Alerts.Firing | len }} Firing ... {{- end }} {{ define "slack.soundcloud.alert_grouping" -}} {{ range .GroupLabels.SortedPairs }}{{ .Name }}="{{ .Value }}" {{ end }} {{- end }}

slide-11
SLIDE 11

Thanks