Change alert summary with conditions

Hi All,

When the alert condition true or false i need to set the alert summery. For that i have used below.
{{ if (eq $values.C.Value 1.0) -}}
Posted Background jobs are reported in {{ index $labels “customer” }} {{ index $labels “environment” }} environment
{{ else -}}
Posted Background jobs are cleared for {{ index $labels “customer” }} {{ index $labels “environment” }} environment
{{- end }}

when the alert condition is true it didn’t show the correct values. Where did i miss ?

Thanks

So what’s that incorrect value? I don’t see any values in true branch of that condition, only string and labels.
Do you edit annotation?

Hi @jangaraj,
If the alert condition true, C=1 then it should give “Posted Background jobs are reported in {{ index $labels “customer” }} {{ index $labels “environment” }} environment” . but give the label for else condition.
{{ if (eq $values.C.Value 1.0) -}} isnt the way for “if C=1” ? if not what is the correct way ?

Thanks
Sahan

I don’t know. You may think that condition is true, but it looks like you are not right.
Just print that value. It can be string, int,… so comparison with float may not be true.