I am working on customizing the alert notification template in Grafana and need assistance with changing the timezone to UTC+08. Currently, my template looks like this:
No solution has been presented as yet. We do include timestamps in UTC on our notifications but they are confusing to calculate at a glance. Is there something I’m missing?
You aren’t using Grafana OnCall as your alert manager, are you? I finally figured out how to do it within OnCall’s templating system (Jinja2/Python), which I will explain below. However, I haven’t yet figured out how to do this within Grafana’s templating system (Go template/text) - sorry.
For OnCall templates, you can use the datetimeformat_as_timezone filter.
As an example: {{ payload.alerts[0].startsAt | iso8601_to_time | datetimeformat_as_timezone('%I:%M %p on %a, %B %d %Z','US/Eastern') }}