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…

resource_name AS metric,
avg(value) AS “value”
FROM readings
$__timeFilter(“timestamp”) AND
resource_name = ‘TEMPERATURE’ AND
device_name = ‘$SENSORs’

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

@rbrothers Hello Ryan,

I have exactly the same question. Could you please provide more details how did you do that with multi dimensional alerting in Grafana 9? Is it available in Grafana 8.5?

edit: Probably you was talking about this video: Alerting in Grafana 9 - YouTube

edit2: Multi-dimensional alerting is working as expected, but if alert rules is connected to Dashboard and Panel, then broken-heart emoji and alerts will be displayed for all devices/sensors. To avoid that we created the Grafana HTTP API Data Source: