Basic Template

  1. Go to Alerting → Contact points and click Add notification template group
  2. Give the template a name and paste the body template (below) into the Alert content area
  3. Click Save

Body

{{ define "metrics_template" }}
  {{ if and .CommonLabels.alertname (ne .CommonLabels.alertname "") -}}
  *Alert:* {{ .CommonLabels.alertname }}
  {{ end }}
  *Status:* {{ if eq .Status "firing" }}🚨 *Firing* 🚨{{ else if eq .Status "resolved" }}✅ *Resolved* ✅{{ else }}ℹ️ *{{ .Status | title }}* ℹ️{{ end }}
  {{ if and .CommonLabels.instance (ne .CommonLabels.instance "") -}}
  *Instance:* {{ .CommonLabels.instance }}
  {{ end }}
  {{- if .CommonAnnotations.panel_url -}}
  *Panel Link:* <{{ .CommonAnnotations.panel_url }}|Click here>
  {{ end }}
  {{ if and .CommonAnnotations.summary (ne .CommonAnnotations.summary "") -}}
  *Summary:* {{ .CommonAnnotations.summary }}
  {{ end }}
  {{ if and .CommonAnnotations.description (ne .CommonAnnotations.description "") -}}
  *Description:* {{ .CommonAnnotations.description }}
  {{ end }}
{{ end }}

Slack Contact Point

Create Webhook

  1. Go to: Slack APIs
  2. Click the Create App button and choose the From scratch option
  3. You’ll be redirected to your new app’s Basic Information page
  4. Click Incoming Webhooks in the left-hand navigation
  5. Scroll down and click Add New Webhook
  6. Select the channel you want alerts sent to
  7. Click Allow
  8. Copy the webhook URL now showing at the bottom of the page

Create Contact Point

  1. In Grafana, go to Alerting → Contact points