Alert rule with regular expression

Hi all,
I got an alert rule with some logic and expression.
At the end, I evaluate an expression (see below)

image

I would like to know if it’s possible use a regexp for the text value of a label?
Or alternatively, how can I extend my expression like (SQL style):
($var > 15360) || ($var2 > 30) AND ({{ $values.A.Labels.server}} IN ‘server1c’,‘serverKK’,‘server14’)

I think, maybe is it only possible to filter label form metric, at the beginning of alert?

Thanks Alen

@alencappelletti what version of grafana are you using, alerting has a couple of flavors depending on your version.

If you’re using 8.x with unified alerting, the preview alert button in your alert configuration page will show a preview of the returned values of your alert query/expression and the labels/values that can be used in your alert notification.

Hi, thanks for your answer… I’m on last version 9.2.6.
Thanks for your tip… yes it’s clear to me the preview of returned values of alert… but
for the example I wrote on my post… the “IN” similar to SQL is possible in the ending of panel?

Exist AND or &&?

Thanks Alen

($var > 15360) || ($var2 > 30) AND ({{ $values.A.Labels.server}} IN ‘server1c’,‘serverKK’,‘server14’)

The values map is the output of the alert evaluation, are you asking if you can access them in your expression?

Hi, no…
I know how to access to the variables…
my question is only related to the syntax…
exists something like the IN function? In the validation of expression?

Alen

Seems not exists an IN like in t-sql…
I merged several alert expressions to raise the real alarm only in the last one, in a boolean mode.

ALEN