Create alert for same query but multiple Mysql datasources

Hello

I have 3 mysql databases. When the query value is over 1 it should send an alert to a certain contact point, depending on which database it is.

The query for the alert is exactly the same.

Is it possible to define this using a single alert rule?

Hi,

If I understand correctly (and my response is based on that), you have a metric that describes 3 different labels, not three different datasources, right?

If so, then if you’re using Grafana >= 8, you can create a multidimensional alert, which will create multiple alert instances based on a single rule. The advantage of this is the labels from the result time series are passed as the alert instance labels. So, if your result time series in an alert has the label database or something representing the database, it would be passed into the alert instance. Then you can create a notification policy that will match this database label and route your notification to a certain contact point (given nothing else matched such an alert).

The solution wasn’t tested by me though, so the answer is only based on my knowledge unfortunatelly.

Hello

Thanks for the fast reply.

I am already using multidimensional alerts. Yes i mean datasources, i ended up creating i alert for each datasource, even though the query is the same.

Alright, so in that case (multiple datasources) I don’t think there’s a way not to copy-paste the query. You could still have one alert (I think) but query would be duplicated.