I am generating a link to grafana dashboard from alerts.
Bottom line, I have to convert .StartsAt to from= and to= in grafana url.
I want to do the following:
{{- .Annotations.URL -}}&from={{- sub .StartsAt.Unix 3600 }}&to={{- .StartsAt.Unix -}}
Create a link to the dashboard url from 1 hour before the alert, so users can nicely navigate the dashboard in the proper time interval.
However, when provisioning the template with terraform, this fails with the message:
│ Error: [PUT /v1/provisioning/templates/{name}][400] putTemplateBadRequest {"message":"invalid object specification: invalid template: template: kc:84: function \"sub\" not defined"}
How am I should I create a link to the dashboard so it properly allows users to analyze the event using the data there were there for the alert to generate?
How to create a link to grafana dashboard from alert that shows data between 1 hour before the alert was generated?
Related: Convert time to epoch in alert notification , Usage of time and time.window or subtract timestamp in notification template , Documentation of Alert Templating in Serious Need of Improvement!
Thanks.