Hi,
I use the latest docker Version of Grafana v9.3.2 with a Timescale database.
I configured email-alerts, if some values of a query are above a threshold.
All work fine. I found the great thread How To Use Alert Message Templates in Grafana - #84 by wrain36 . But I dont need print the value. I want print the date and time of the event.
In a dashboard I can use global Variables $__from, $__to.
Which variable can I use in a template or new annotation for the time? It can be the actual time or the alert time, which is the x-value in the chart of the alert value.
Hi @georgerobinson ,
Is there a way to add that time inside annotation or label? I tried referencing variable with {{ .StartsAt }} but that didn’t work.
I would like to use that variable inside DashboardURL variable so that when user clicks on link it opens specific dashboard with ±1h time range from time when alert started. Here is a link on my topic about mentioning startsAt inside annotations or labels:
Hi! It’s not available in annotations or labels, just notification templates. The reason for this is that Grafana doesn’t known if the alert is firing until after custom labels and annotations have been templated.
That’s a shame. I would be happy if grafana would print something like <No value> if startsAt variable is not set because those alerts would not be sent to users anyway since they are not in alerting/active state.
Hi @georgerobinson,
Can we use global variables in alert rule annotations. Like say $__from and $__to. If yes then how? And does from and to variables here refer to the from and to time which we have given to the alert rule to process the alert?
If we are able to use this then @ldrascic problem would also be resolved with that.