Open source Enterprise Grafana Cloud
Last reviewed: August 19, 2026

Template reference

The data a notification template can read. The top-level context is one notification, covering a group of alerts.

Top-level fields

FieldTypeContains
.ReceiverstringName of the receiver being notified
.Statusstringfiring if any alert in the group is firing, otherwise resolved
.AlertslistEvery alert in the group
.Alerts.FiringlistOnly the firing alerts
.Alerts.ResolvedlistOnly the resolved alerts
.GroupLabelsmapThe labels this group was grouped by
.CommonLabelsmapLabels shared by every alert in the group
.CommonAnnotationsmapAnnotations shared by every alert in the group
.ExternalURLstringURL of the Alertmanager sending the notification

Fields on each alert

Inside {{ range .Alerts }}, the dot becomes one alert:

FieldTypeContains
.Statusstringfiring or resolved
.LabelsmapThe alert’s labels
.AnnotationsmapThe alert’s annotations, already rendered by the ruler
.StartsAttimeWhen the alert started firing
.EndsAttimeWhen it ended, for resolved alerts
.GeneratorURLstringLink back to the rule in the source system
.FingerprintstringIdentifier derived from the alert’s labels

Common compared with group labels

These three are easy to confuse:

  • .GroupLabels: the labels named in group_by. Always present, always identical across the group.
  • .CommonLabels: labels that happen to be identical across every alert in the group. A wider set than .GroupLabels, and it shrinks as the group becomes more varied.
  • .Labels, inside a range: that one alert’s labels, including the ones that differ.

A template using .CommonLabels.instance renders correctly while a group holds one instance and renders empty the moment a second joins. When a value has to be present, use .GroupLabels or read it per alert inside a range.

Accessing a label

Go
{{ .GroupLabels.alertname }}
{{ .CommonLabels.severity }}
{{ range .Alerts }}{{ .Labels.instance }}{{ end }}

For label names that aren’t valid identifiers—anything with a dot or dash—use index:

Go
{{ index .CommonLabels "k8s.namespace" }}

Formatting times

Go
{{ .StartsAt.Format "2006-01-02 15:04:05 MST" }}

Go’s reference time is 2006-01-02 15:04:05; the layout string is that exact moment written the way you want your output to look.

Where the annotation content comes from

.Annotations holds values the ruler already rendered during evaluation. A notification template can read and rearrange them, but it can’t recover information the alert never carried. That has to be added at the rule. Refer to Template annotations and labels.