Grafana 8.5 alerting with variables

I have a dashboard that I use variables to choose between different devices. There variable is called SENSORs and I have an alert set up to go off if it is above a certain value. I was wondering if there was a way to select the variable in the query i.e…

SELECT
$__timeGroupAlias(“timestamp”,1m),
resource_name AS metric,
avg(value) AS “value”
FROM readings
WHERE
$__timeFilter(“timestamp”) AND
resource_name = ‘TEMPERATURE’ AND
device_name = ‘$SENSORs’
GROUP BY 1,2
ORDER BY 1,2

This seems to work but every visualization has the same alerts on it at the same time, even if the sensor isn’t alerting. Is there a way to do this or will I have to make separate dashboards/alerts on all sensors?

Thank you

Can you confirm: are you using the new Unified Alerting platform or the legacy platform?

1 Like

I was able to actually get this to work with multi dimensional alerting in grafana 9. Great feature!

1 Like