Not sure what exactly your use case is, but if you just want the current (at the time of alert evaluation) Unix timestamp in an annotation, you should be able to do:
{{ with query "time()" }}{{ . | first | value }}{{ end}} Note that the "Alert" struct on the Alertmanager templating side will also have timestamp fields on it that tell you when an alert first started firing, and when it will expire if it's no longer sent from Prometheus: https://prometheus.io/docs/alerting/notifications/#alert On Wed, May 20, 2020 at 5:59 AM zichen chuh <zichen.c...@gmail.com> wrote: > I went through documents given by prometheus website and didn't find a > clue. > > From alerting_rules > <https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/#templating> > , > only 3 variables are available : $lables, $externalLabels, $value. > > Thanks in advance. > > -- > 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 prometheus-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/prometheus-users/d5b9244a-1582-4816-a314-9b7c9917aa10%40googlegroups.com > <https://groups.google.com/d/msgid/prometheus-users/d5b9244a-1582-4816-a314-9b7c9917aa10%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Julius Volz PromLabs - promlabs.com -- 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 prometheus-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CAObpH5wKfMQiv%2BqMFH9siMb6YoqQ%3DHbRmORz%2BADb7t6rZ7ii5w%40mail.gmail.com.