I have configured a Grafana (v11.1.0) alert where alert should fire if the max value of any of the three parameters, say A, B and C is greater than 0. I have defined the custom message in the alert annotation section. The alerts are firing, however, the template is not evaluated. Entire template is printed as is. Below are more details.
Reduce statements are defined each parameter, say, D, E, F. All of them has similar criteria. Below is sample screenshot for one of them.
Annotation section:
Summary:
{{if or (gt $values.D.value 0) (gt $values.E.value 0)-}}
Message1
{{else -}}
Message2
{{end }}
Output in the alert:
{{if or (gt $values.D.value 0) (gt $values.E.value 0)-}}
Message1
{{else -}}
Message2
{{end }}
Description:
{{if (gt $values.D.value 0) -}}
Message3
{{else if (gt $values.E.value 0) -}}
Message4
{{else -}}
Message5.
{{end }}
Output in the alert:
{{if (gt $values.D.value 0) -}}
Message3
{{else if (gt $values.E.value 0) -}}
Message4
{{else -}}
Message5.
{{end }}
I have cross checked with documentation and online examples and observed that the templates I have defined looks ok. However I am not sure why the are not working. This is the first Alert I am working on. So, don’t have much expertise on this. Please let me know if I am missing something.