Using a math expression value in a classic condition

Hello Guys,

Appretiate any help with the below.

  • What Grafana version and what operating system are you using?
    8.2.2

  • What are you trying to achieve?
    I am trying to pull the value of a math expression for an alert to create a classic condition to alert on.

  • How are you trying to achieve it?

  • What happened?
    I get the error: Failed to evaluate queries and expressions: failed to execute conditions: only data source queries may be inputs to a classic condition, E is a Expression

  • What did you expect to happen?

I was hoping it would let me use the math expression in my classic condition to fire an alert.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

Failed to evaluate queries and expressions: failed to execute conditions: only data source queries may be inputs to a classic condition, E is a Expression

2 Likes

Welcome to the Grafana forum.

I think you can definitely achieve what you want, but maybe not using the Classic Condition. What is your datasource? It appears from your screenshot that you already have some queries working and presumably displaying your data. Can you post those here?

I have the same problem and want to use classic condition expression with math expression, grafana 8.3.3.

Use case:
Query A (elasticsearch) - Count(A)
Query B (elasticsearch) - Count(B)
Expression Math: Count(A) / Count(B) * 100 - to have percentage
Expression Classic Condition: When exp_math is Above X trigger alert

So simple and does not work.

2 Likes

I have the same problem once I upgraded to 8.3.3.

Anyone has news about this operations ?

I’ve also hit this same condition, and am unclear on how to work around it. Please advise, and thank you!

Sounds like this may help:

Adding a reduce and selecting last value allowed me to create an alert:

1 Like

it worked for me:
Use case:
Query A (elasticsearch) - Count(A)
Query B (elasticsearch) - Count(B)
Expression Reduce A
Expression Reduce B
Expression Math: ($C * 100) / $D < 80

1 Like

I have the same problem with 8.3.3.

This topic was automatically closed after 365 days. New replies are no longer allowed.