I am setting up an alert in Grafana.
My query works, and triggering the alert condition also works. The issue is that writing down query results in a summary of the alert does not. It is sent to Slack, but the dynamic values in the summary are not changed as expected.
Here is an example of what MySQL query results in:
Table
{target="user-1", traffic_details="Traffic: 151 Mb, Traffic Limit: 100 Mb"} 1
{target="user-2", traffic_details="Traffic: 1,989 Mb, Traffic Limit: 1,000 Mb"} 1
I want my alert summary to look something like this:
Users that exceeded traffic limit:
user-1, Traffic: 151 Mb, Traffic Limit: 100 Mb
user-2, Traffic: 1,989 Mb, Traffic Limit: 1,000 Mb
I tried out different solutions like these:
Users that exceeded traffic limit:
{{range rows}}
* {{.target}}, {{.traffic_details}}
{{end}}
and
Users that exceeded traffic limit:
{{ range $index, $value := .Values }}
{{ if gt $index 0 }}
<br>
{{ end }}
* {{ $value.__data.labels.target }}, {{ $value.__data.values.traffic_details }}
{{ end }}
and
Users that exceeded traffic limit:
{{ humanize $values.A.Value }}
(A is the block of the query in “Set a query and alert condition”)
All of these are represented in Slack exactly like they are written down in the summary without dynamic values changed.
How to write down the summary so the Grafana alert will take the values from the MySQL query result and correctly display them in the slack message?