I have read the post: Use Dashboard Variables in Alerts. And, I find that I have similar requirements. The example in that post uses Prometheus data source, and I am wondering whether Infinity data source can be used to create a multi-dimensional alerts or not?
I have a dashboard and set a dashboard variable: itemId, so I can use ${itemId} in the API query with Infinity data source. The dashboard variable makes it possible to create only one dashboard for multiple itemId query.
Now, I want to have only one alert rule which can automatically create many alert instances for more than one itemId. Is there a way to make it with Infinity data source? By the way, my Grafana version is v11.0.0.
I do not see why it would not be possible. Can you redo your query to NOT use a dashboard variable, which would then be used in the Alerts section of Grafana. You could always create another dashboard for user-friendly purposes that uses a template variable as you have already done.
I will try to do this later today, but IIRC, all my Infinity dashboards do not use variables, so I will have to concoct something and then create an alert.
Hi @grant2 , my words are a little bit confusing, which may lead to misunderstanding.
Currently, my alert rules do not use any dashboard variable because I know it cannot work. So, what I can do (as a workaround) is to hard-code the item id in the query, which means one alert rule is for only one item id. However, it does not fulfill my needs.
Assuming that the query is like: http://mysite.com/items/100, and it returns a time series data like: [{timestamp: 1000, id: 100, value: 500}, {timestamp: 1001, id: 100, value: 490}] (never mind the format of the timestamp, it’s just for demonstration). Could you provide a simple example to show how to create a multi-dimensional alert rule which can automatically create 3 alert instances for id = 100, 101, 102?