Use Variable in Alert Notficiation Message

I am using grafana for alerting my six nodes when they are down.

Since alerting doesn’t support template variables, I have created six different queries in the metrics section which is:

Also, I have created an Alert.

While configuring the alert notification message, I have to write the message dynamically such as if node 1 is down, the message will be: Node1(value is taken from a variable) is down.

How can I do it in an alert notification message?

5 Likes

is there any answer to this question?

2 Likes

Anyone figured out how to achieve this?

Anyone? got anything yet?

1 Like

Grafana already has that feature to send the respective node name when you setup the graph using the query by node. I am not sure if you have tried that option.

example in prometheus: up{job=“node-exporter”} would provide a number, if it is zero grafana will alert on respective node.

@beingyash Did you find solution for that?

There hasn’t been an implementation of that feature request till date @yeya.

Is it possible with new update of Grafana because I am having a similar problem?

I am in Grafana v8.0.6, it has notice that is
image
But I still cannot use it. How to dynamically set text in message body alert?

For anyone watching this long lived thread, please have a look at message templating in Grafana 8 alerts. @hoangmnsd I would recommend that you try our a newer release. We’ve made a ton of updates to templating, variables, etc in the past few releases.