4

is here any body knows how to use system variables in Grafana-Alert-Message? especially for the value of "threshold"

As we know, we can configure the alert triggers on "grafana panel", according to the predefined values of last() or avg() etc/, but how can we pass those variables in "Alert Notification Message"? like the parameters used below:

Metrics Name is: ${__name__}
AlertName is: ${alertname}
Instance is: ${instance}
Job is: ${job}
HostName is: ${hostname}
Handler is: ${handler}

i am wondering if i could put some descriptions in the notification like: The value of ${var_1} exceeded the threshold of ${var_threshold}.

Thanks in advance.

1 Answers1

0

Suppose your alert definition uses some queries and expressions. If your value is from query C and your limit is from expression D, then you could edit your summary or description or any annotation field to look like this:

> The value of {{ $values.C.Value }} exceeded the threshold of {{ $values.D.Value }}.

If your condition (threshold) is manual (such as a condition that says result of query C is higher than 400 (fixed value)), I don't know how you could read that value and put it in the annotations. That is why we are reading the threshold value from another source (another query). And also because we have many alerts referring same threshold, and if you want to modify the threshold it's better to modify in one place, not to edit each of the alerts individually (200+).

Good luck!

dorin
  • 1