Severity Alerts

Thanks to georgerobinson and yuriy.tseretyan I’ve been able to get dynamic labeling working perfectly! Now on to the next thing.

I need two severity levels for email alerts, warning and critical. I have the following math expression set up:

The preview gives the proper response. However, how do I actually set it up for notification? I have the following:

The expression in labels is:

  • host={{ {{if gt $values.B.Value 90.0 }}critical{{else}}warning{{end}}

I have a notification with basically the same information:

Yet no emails are coming through. I had two separate alerts, one for warning one for critical and hosts = rh8 notification policy works. What am I missing on this?

Currently testing if {{ {{if gt $values.C.Value 90.0 }}critical{{else}}warning{{end}} works

Okay that somewhat works. However I don’t think it’s right:

image
image

image

Not really showing it right. And if I look at the C operator, of course it’s going to be over 1. How do I get the B operator to work?

Is there a template I need to create?

All I would like the email to display is the following:

Subject to have:

[FIRING:1] Alert Name Hosts (server.name At $value WARNING/CRITICAL) - based on {{ $values.X }}

And under host

image

Display the value and whether or not warning or critical

The host label has an error in it, there are two {{ at the start:

{{ {{if gt $values.B.Value 90.0 }}critical{{else}}warning{{end}}

It should be just:

{{if gt $values.B.Value 90.0 }}critical{{else}}warning{{end}}

Where does it put that information in the email? Subject?

I have placed it in the labels section, but I am no longer getting messages:

What do I need to do for this to work?

Hi Jason! I’d recommend checking out this blog post, it should help you get what you want and explain how labels and annotations work in Grafana.