I want to configure the notification message of an alert. I have a query that returns an error type, if there’s an error the alert message should say the error type in the same way a value mapping in Grafana translates numbers to text following this rule
When configuring the alert rule, the raw value of this variables is given by this {{$values.B}}
which works correctly. Reading about the templating language syntax, I thought of using this
{{ if (eq $values.B 1) -}}
OverTemperature
{{ else if (eq $values.B 2) -}}
ThermocoupleFail
{{ else if (eq $values.B 3) -}}
NoFlame
{{ else if (eq $values.B 4) -}}
GasWhileDrying
{{ else if (eq $values.B 5) -}}
GasNoAir
{{ else if (eq $values.B 6) -}}
GasNotFiring
{{ else -}}
None
{{- end }}
Adding this code on the notification description or in a label doesn’t work. Instead I see raw template code in the notification when an alarm is triggered. I am going a bit crazy over this and already checked out the docs Alerting template language | Grafana documentation
Ultimately I’d like to have a concise alarm notification, specially when using the oncall integration. This is what I get at the moment and is full of clutter
Any advice or resources to help me achieve this are greatly appreciated!
Thanks.