Grafana - Single alert rule for multiple instances of a library panel

333 views Asked by At

I have multiple dashboards sharing the same library panel, say "CPU Load". Each dashboard has a different Prometheus Data Source and customer ID. Both datasource and customerID are variables in the dashboard settings, hence the library panel is configured like this (simplified):

Data Source: ${datasource}
Query: cpu_load{customer="$customerID"}

I want to create a single alert rule to trigger an alert whenever CPU load is above a certain threshold in any of the dashboards where the library panel "CPU Load" is present, instead of creating one Alert Rule for each instance of the panel with hardcoded datasource and customerID.

Is this even possible? I'm using Grafana 9.4.7.

Thanks

1

There are 1 answers

0
markalex On BEST ANSWER

No, this is not possible.

Grafana doesn't support variables in alerting rules.

Note: Grafana does not support alert queries with template variables. More information is available at https://community.grafana.com/t/template-variables-are-not-supported-in-alert-queries-while-setting-up-alert/2514.

Not to mention data source variables, to create alerts over multiple sources.

You'll need to define a per-data-source alert.