Template variables are not supported in alert queries

While setting alarm for CPU usage in grafana, facing below error

Please help me

The error is saying that template variables (the dropdowns that are used to dynamically change the query - maybe a list of servers in your case?) are not supported in queries that are used for alerting. To get alerting to work you will have to remove any template variables from your query.

This means you will either have to have multiple panels - one per template variable value per panel or use regex instead of the template variable.

There is a feature request for this but no-one has come up with a good solution so far (template variables based on a query can be very dynamic which makes it difficult to implement for alerting):

1 Like

Hi guys ,

Would it be possible to give an example on how to avoild template variables in Grafana queries