Groups
Groups
Sign in
Groups
Groups
Prometheus Users
Conversations
About
Send feedback
Help
Getting the epoch ms of triggered alert
262 views
Skip to first unread message
Dudi Cohen
unread,
Jul 27, 2022, 6:43:09 AM
7/27/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Prometheus Users
Hi,
I want to include a link to a Grafana dashboard within a Prometheus alert rule.
The time of the alert should be added as a query parameter in the dashboard URL so that the link leads you to the time when the alert was triggered.
According to the Grafana docs the time query needs to be in epoch ms:
https://grafana.com/docs/grafana/next/dashboards/manage-dashboard-links/#controlling-time-range-using-the-url
Alertmanager has a `StartsAt` function which gives the current time:
https://prometheus.io/docs/alerting/latest/notifications/#alert
Is there a way to convert this time output to epoch ms so I can use it within the Grafana dashboard URL?
Thanks
David Leadbeater
unread,
Jul 27, 2022, 7:43:57 AM
7/27/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Dudi Cohen, Prometheus Users
Hi,
It's not pretty but you can use: {{ .StartsAt.Unix }}000
There's various other alternatives in the comments on
https://github.com/prometheus/alertmanager/issues/1188
David
> --
> 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-use...@googlegroups.com
.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/prometheus-users/af28e96b-255c-41af-b05a-624caa18a897n%40googlegroups.com
.
Dudi Cohen
unread,
Jul 27, 2022, 8:31:07 AM
7/27/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Prometheus Users
That did the trick, thanks a lot!
Reply all
Reply to author
Forward
0 new messages