vinisha harinarain
vinisha harinarain

Reputation: 51

Grafana message templates

I am currently setting up grafana alerts. How do I customize my message template so my alert email shows The ip address of the server, the state of the server and the node/instance?

Thank you.

Upvotes: 5

Views: 3250

Answers (1)

Kyle Burkett
Kyle Burkett

Reputation: 1443

I figured it out once, then recently I updated my grafana instance that wiped my work and I had to figure it out again. It was tough the first time.

You can use the labels that are made available through prometheus in your summary and description sections in your alerts by using the syntax:

{{$labels.instance}} {{$labels.value}}

https://prometheus.io/docs/prometheus/latest/configuration/template_examples/

The only catch is that you have to use Math expression in the last condition in your alert rule for the labels to be available in the Summary section of the alert.

For example, in our personal alerts we will use something like:

Machine {{$labels.instance}} is not reporting status via win-exporter. 
The machine could be offline or the service could be stopped.

Upvotes: 0

Related Questions