Search code examples
grafanaazureservicebusinfluxdbsensorsgrafana-alerts

How can I dynamically pass value from my alert condition/Query condition to my notification?


I am using Grafana v8.3.4 with influxDB & I want to pass dynamic value to my notification for the query/alert condition. I couldn’t find any documentation for this. Can anyone suggest? enter image description here

This is what I have used: enter image description here

It alerts if the last() value is greater than threshold value. I want to dynamically pass the last() & Threshold value to the notification whose format is:

enter image description here Please suggest how it can be achieved.


Solution

  • I'm not sure if I got your question but if you want to access the value in notifications/annotations you can use {{ $values.B0.Value }} where B is your query and 0 is the condition number. (In this case, that is 0 because you only have one condition.)

    Annotations and labels for alerting rules

    See example:

    See example

    Akshay's example:

    Akshay's example

    Alarm definition in grafana:

    Alarm definition in grafana