Menu
Grafana Cloud Open source

Reference

Data

Alert

NameKindDescriptionExample
StatusstringFiring or resolved{{ .Status }}
LabelsKVThe labels for this alert{{ .Labels }}
AnnotationsKVThe annotations for this alert{{ .Annotations }}
ValuesKVThe values of all expressions, including Classic Conditions{{ .Values }}
StartsAtTimeThe time the alert fired{{ .StartsAt }}
EndsAtTime{{ .EndsAt }}
GeneratorURLstringA link to Grafana, or the Alertmanager if using an external Alertmanager{{ .GeneratorURL }}
SilenceURLstringA link to silence the alert{{ .SilenceURL }}
DashboardURLstringA link to the Grafana Dashboard if the alert has a Dashboard UID annotation{{ .DashboardURL }}
PanelURLstringA link to the panel if the alert has a Panel ID annotation{{ .PanelID }}
FingerprintstringA unique string that identifies the alert{{ .Fingerprint }}
ValueStringstringA string that contains the labels and value of each reduced expression in the alert.{{ .ValueString }}

ExtendedData

NameKindDescriptionExample
ReceiverstringThe name of the contact point sending the notification{{ .Receiver }}
StatusstringThe status is firing if at least one alert is firing, otherwise resolved{{ .Status }}
Alerts[]AlertList of all firing and resolved alerts in this notificationThere are {{ len .Alerts }} alerts
Firing alerts[]AlertList of all firing alerts in this notificationThere are {{ len .Alerts.Firing }} firing alerts
Resolved alerts[]AlertList of all resolved alerts in this notificationThere are {{ len .Alerts.Resolved }} resolved alerts
GroupLabelsKVThe labels that group these alerts in this{{ .GroupLabels }}
CommonLabelsKVThe labels common to all alerts in this notification{{ .CommonLabels }}
CommonAnnotationsKVThe annotations common to all alerts i this notification{{ .CommonAnnotations }}
ExternalURLstringA link to Grafana, or the Alertmanager that sent this notification if using an external Alertmanager{{ .ExternalURL }}

KV

KV is a set of key value pairs, where each key and value is a string. If a KV happens to contain numbers or bools then these are string representations of the numeric or boolean value.

Here is an example of a KV, the annotations of an alert:

summary: 'A summary of the alert'
description: 'A description of the alert'

In addition to iterating over each key value pair, you can sort the pairs, remove keys, and iterate over just the keys or the values.

NameDescriptionArgumentsReturnsExample
SortedPairsSorts{{ .Annotations.SortedPairs }}
RemoveReturns a copy of the KV with the keys removed[]string{{ .Annotations.Remove "summary" }}
NamesA list of the names{{ .Names }}
ValuesA list of the values{{ .Values }}

Time

Time is from the Go time package. You can print a time in a number of different formats. For example, to print the time that an alert fired in the format Monday, 1st January 2022 at 10:00AM you would write the following template:

{{ .StartsAt.Format "Monday, 2 January 2006 at 3:04PM" }}

You can find a reference for Go’s time format here.