Changes
Page history
prom: document templating system a little bit more
authored
Oct 05, 2024
by
anarcat
Show whitespace changes
Inline
Side-by-side
service/prometheus.md
View page @
297ee9ed
...
...
@@ -662,6 +662,19 @@ depending on the Alertmanager routing. The `summary` field ends up in
the
`Subject`
field of outgoing email, and the
`description`
is the
email body, for example.
Those fields are
[
Golang templates
][]
with variables accessible with
curly braces. For example,
`{{ $value }}`
is the actual value of the
metric in the
`expr`
query. The list of available variables is
somewhat obscure, but some of it is visible in the
[
Prometheus
template reference
][]
and the
[
Alertmanager template reference
][]
. The
Golang templating system also comes with its own
[
limited set of
built-in functions
][]
.
[
Prometheus template reference
]:
https://prometheus.io/docs/prometheus/latest/configuration/template_reference/
[
Alertmanager template reference
]:
https://prometheus.io/docs/alerting/latest/notifications/
[
limited set of built-in functions
]:
https://pkg.go.dev/text/template#hdr-Functions
[
Golang templates
]:
https://pkg.go.dev/text/template
### Writing a playbook
Every alert in Prometheus
*must*
have a playbook annotation. This is
...
...
...
...