mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Updated alert templating docs (#3596)
The docs suggest that alert templating only works in the summary and description annotation fields. Some testing and a review of the code suggests this is no longer true and that you can template any annotation field.
This commit is contained in:
parent
9c9f96b2c0
commit
c3f9238756
|
@ -5,11 +5,11 @@ sort_rank: 4
|
||||||
|
|
||||||
# Template examples
|
# Template examples
|
||||||
|
|
||||||
Prometheus supports templating in the summary and description fields of
|
Prometheus supports templating in the annotations and labels of alerts,
|
||||||
alerts, as well as in served console pages. Templates have the ability to run
|
as well as in served console pages. Templates have the ability to run
|
||||||
queries against the local database, iterate over data, use conditionals, format
|
queries against the local database, iterate over data, use conditionals,
|
||||||
data, etc. The Prometheus templating language is based on the
|
format data, etc. The Prometheus templating language is based on the [Go
|
||||||
[Go templating](http://golang.org/pkg/text/template/) system.
|
templating](http://golang.org/pkg/text/template/) system.
|
||||||
|
|
||||||
## Simple alert field templates
|
## Simple alert field templates
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ expr: up == 0
|
||||||
for: 5m
|
for: 5m
|
||||||
labels:
|
labels:
|
||||||
- severity: page
|
- severity: page
|
||||||
|
|
||||||
annotations:
|
annotations:
|
||||||
- summary: "Instance {{$labels.instance}} down"
|
- summary: "Instance {{$labels.instance}} down"
|
||||||
- description: "{{$labels.instance}} of job {{$labels.job}} has been down for more than 5 minutes."
|
- description: "{{$labels.instance}} of job {{$labels.job}} has been down for more than 5 minutes."
|
||||||
|
|
|
@ -5,11 +5,11 @@ sort_rank: 5
|
||||||
|
|
||||||
# Template reference
|
# Template reference
|
||||||
|
|
||||||
Prometheus supports templating in the summary and description fields of
|
Prometheus supports templating in the annotations and labels of alerts,
|
||||||
alerts, as well as in served console pages. Templates have the ability to run
|
as well as in served console pages. Templates have the ability to run
|
||||||
queries against the local database, iterate over data, use conditionals, format
|
queries against the local database, iterate over data, use conditionals,
|
||||||
data, etc. The Prometheus templating language is based on the
|
format data, etc. The Prometheus templating language is based on the [Go
|
||||||
[Go templating](http://golang.org/pkg/text/template/) system.
|
templating](http://golang.org/pkg/text/template/) system.
|
||||||
|
|
||||||
## Data Structures
|
## Data Structures
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue