Alerts do not come back to normal state when conditions are not verified

Hi all I have configured alerts related to a graph. Notifications are sent through email and Telegram: wonderful!

My Alert condition sets the Alert to NO-DATA if there are no data for a specific measurement in the last hour.
I’d expect that I receive another notification when the Alert condition is not verified anymore. So that it “closes” the Alert.

But I never receive a notification, and the Alert is still in condition NO-DATA even if data are present in that specific measurement. Can you help me?

I attach the configuration for the alert

What does your alert state history say?

thanks @torkel for the answer.

Alerting for 6 days right now…

That is not the state history view, go to alert rule then, on the side menu it says state history

sorry, this is the right one. I attach also the graph to show you data for last 2 days.

bump @torkel can you please point me in the right way? It would be very useful if you or any other expert can.

Thanks anyone in advance

What is the output of the test rule action? You can see query response info there

What version of Grafana are you on?

Thanks @torkel you have pointed me in the right direction :wink:

I have tested the rule and I got “no data”. So I raised the log_level to “debug” and I got that the ‘$hostname’ in the query A of the graph has not been translated :frowning: so the query to influxdb is:


is it a bug or a feature? :wink:

For testing purposes I can create a dashboard for the specific hostname avoiding to put it in the template, but what about alerts running on multiple values of a template variable? Have you planned something for them?

Thank you a lot

It’s not a bug, template variables are not supported in alert queries, should be a big warning in alert tab about this.

There is currently no support for template variables in alerting. See this feature request. Unfortunately it is technically difficult to implement in a consistent way and difficult to implement visually.

thank you all guys, if I have something to say I will add to the feature request (how long!!! oh my god!). Shoud I mark the thread as solved or somewhat else?