instruction: Configure AlertManager for Notification template reference | Prometheus Prometheus Docs Download Community Support &amp; Traini...
output: Notification template reference | Prometheus Prometheus Docs Download Community Support &amp; Training Blog Ctrl + K Show nav Introduction Overview First steps Comparison to alternatives FAQ Roadmap Design documents Media Glossary Long-term support Concepts Data model Metric types Jobs and instances Prometheus Server Getting started Installation Configuration Configuration Recording rules Alerting rules Template examples Template reference Unit testing for rules HTTPS and authentication Querying Basics Operators Functions Examples HTTP API Remote Read API Storage Federation HTTP SD Management API Command Line prometheus promtool Migration API stability Feature flags Visualization Expression browser Grafana Perses Console templates Instrumenting Client libraries Writing client libraries Pushing metrics Exporters and integrations Writing exporters Exposition formats UTF-8 escaping schemes Content negotiation Operating Security Integrations Alertmanager Alerting overview Alertmanager Configuration Clients Notification template reference Notification template examples Management API HTTPS and authentication Best practices Metric and label naming Consoles and dashboards Instrumentation Histograms and summaries Alerting Recording rules When to use the Pushgateway Remote write tuning Guides Basic auth Monitoring Docker container metrics using cAdvisor Use file-based service discovery to discover scrape targets Instrumenting a Go application Understanding and using the multi-target exporter pattern Monitoring Linux host metrics with the Node Exporter OpenTelemetry UTF-8 in Prometheus Docker Swarm Query log TLS encryption Tutorials Getting started with Prometheus Understanding metric types Instrumenting HTTP server written in Go Visualizing metrics using Grafana Alerting based on metrics Specifications Native Histograms [EXPERIMENTAL] OpenMetrics 1.0 Remote Write 1.0 2.0 Notification Template Reference Prometheus creates and sends alerts to the Alertmanager which then sends notifications out to different receivers based on their labels. A receiver can be one of many integrations including: Slack, PagerDuty, email, or a custom integration via the generic webhook interface. The notifications sent to receivers are constructed via templates. The Alertmanager comes with default templates but they can also be customized. To avoid confusion it&#x27;s important to note that the Alertmanager templates differ from templating in Prometheus , however Prometheus templating also includes the templating in alert rule labels/annotations. The Alertmanager&#x27;s notification templates are based on the Go templating system. Note that some fields are evaluated as text, and others as HTML which will affect escaping. Data Structures Data Data is the structure passed to notification templates and webhook pushes. Name Type Notes Receiver string Defines the receiver&#x27;s name that the notification will be sent to (slack, email etc.). Status string Defined as firing if at least one alert is firing, otherwise resolved. Alerts Alert List of all alert objects in this group ( see below ). GroupLabels KV The labels these alerts were grouped by. CommonLabels KV The labels common to all of the alerts. CommonAnnotations KV Set of common annotations to all of the alerts. Used for longer additional strings of information about the alert. ExternalURL string Backlink to the Alertmanager that sent the notification. The Alerts type exposes functions for filtering alerts: Alerts.Firing returns a list of currently firing alert objects in this group Alerts.Resolved returns a list of resolved alert objects in this group Alert Alert holds one alert for notification templates. Name Type Notes Status string Defines whether or not the alert is resolved or currently firing. Labels KV A set of labels to be attached to the alert. Annotations KV A set of annotations for the alert. StartsAt time.Time The time the alert started firing. If omitted, the current time is assigned by the Alertmanager. EndsAt time.Time Only set if the end time of an alert is known. Otherwise set to a configurable timeout period from the time since the last alert was received. GeneratorURL string A backlink which identifies the causing entity of this alert. Fingerprint string Fingerprint that can be used to identify the alert. KV KV is a set of key/value string pairs used to represent labels and annotations. type KV map[string]string Annotation example containing two annotations: { summary: &quot;alert summary&quot;, description: &quot;alert description&quot;, } In addition to direct access of data (labels and annotations) stored as KV, there are also methods for sorting, removing, and viewing the LabelSets: KV methods Name Arguments Returns Notes SortedPairs - Pairs (list of key/value string pairs.) Returns a sorted list of key/value pairs. Remove []string KV Returns a copy of the key/value map without the given keys. Names - []string Returns the names of the label names in the LabelSet. Values - []string Returns a list of the values in the LabelSet. Functions Note the default functions also provided by Go templating. Strings Name Arguments Returns Notes title string strings.Title , capitalises first character of each word. toUpper string strings.ToUpper , converts all characters to upper case. toLower string strings.ToLower , converts all characters to lower case. trimSpace string strings.TrimSpace , removes leading and trailing white spaces. match pattern, string Regexp.MatchString . Match a string using Regexp. reReplaceAll pattern, replacement, text Regexp.ReplaceAllString Regexp substitution, unanchored. join sep string, s []string strings.Join , concatenates the elements of s to create a single string. The separator string sep is placed between elements in the resulting string. (note: argument order inverted for easier pipelining in templates.) safeHtml text string html/template.HTML , Marks string as HTML not requiring auto-escaping. stringSlice ...string Returns the passed strings as a slice of strings. date string, time.Time Returns the text representation of the time in the specified format. For documentation on formats refer to pkg.go.dev/time . tz string, time.Time Returns the time in the timezone. For example, Europe/Paris. since time.Time time.Duration , returns the duration of how much time passed from the provided time till the current system time. humanizeDuration number or string Returns a human-readable string representing the duration, and the error if it happened. Previous Clients Edit Edit this page Next Notification template examples On this page © Prometheus Authors 2014- 2025 | Documentation Distributed under CC-BY-4.0 © 2025 The Linux Foundation. All rights reserved. The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.