My timezone is set to SAST on the server but all alerts are stuck in UTC. On Sunday, August 15, 2021 at 1:48:23 PM UTC+2 Brian Candler wrote:
> Just a thought, but what local timezone is your system set to? (e.g. > Ubuntu/Debian: "dpkg-reconfigure tzdata") > > On Sunday, 15 August 2021 at 09:44:48 UTC+1 bgz wrote: > >> I am trying to get alerts with a local timezone as a timestamp and i >> don't seem to be getting ti right all notifications go out as UTC.. I want >> to set this in two places in annotations and in my template. But these are >> just ignored by prometheus. I found this link: >> >> >> https://utcc.utoronto.ca/~cks/space/blog/sysadmin/PrometheusAlertTimeFormatting >> >> But the link does not explain where do you need to set this exactly. >> >> The way i set it in my email template is like this in the >> alertmanager.yml file: >> >> *text*: >- >> >> {{ range .Alerts -}} >> >> **Time*: {{ .StartsAt.Local.Format "Sat Aug 14 10:15:40 SAST >> 2021" }} {{ end }} >> >> **Alert*:* {{ .Annotations.title }}{{ if .Labels.severity }} - >> `{{ .Labels.severity }}`{{ end }} >> >> **Description*:* {{ .Annotations.description }} >> >> **Details*:* >> >> {{ range .Labels.SortedPairs }}: *{{ .Name }}:* `{{ .Value }}` >> >> {{ end }} >> >> {{ end }} >> I tried annotations in the alerts file as well but these are just flat >> out ignored. >> >> *annotations*: >> >> *timestamp*: > >> >> *time*: {{ range .Alerts.Firing }} >> >> {{ .StartsAt.Local.Format "Sat Aug 14 10:15:40 SAST >> 2021" }} >> >> {{ end }} >> >> What am i doing wrong? Has anyone gotten it to work? I am using >> alertmanager 0.21.0 and Prometheus 2.24.1 >> >> >> >> >> -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/3090c015-1d19-4291-b5a7-2241dec3e82fn%40googlegroups.com.

