Alertmanager rules, adding the expr field to annotations

33 views
Skip to first unread message

Răzvan-Sebastian Botez

unread,
Feb 26, 2020, 6:57:17 AM2/26/20
to Prometheus Users
I've been searching for a while but I wasn't able to find a solution and would need some help with this.
Say I have an alert like this one:

                  "alert": "myalertname",
                  "annotations": {
                     "description": "This is a description.",
                     "query": "I want my expr field here",
                     "summary": "This is a summary"
                  },
                  "expr": "my_expression(1)",
                  "labels": {
                     "severity": "high"
                  }

... and I would like to include the query inside the "expr" field into my annotations, without manually adding it in there for every single alert.

Is this exposed as a variable somehow? Can I reference it in another way, maybe?

The end goal is to have it shown in the PagerDuty alert so it's easily accessible to the responders without having them search the repo containing the alert definitions.

Thanks!

Simon Pasquier

unread,
Feb 26, 2020, 8:52:06 AM2/26/20
to Răzvan-Sebastian Botez, Prometheus Users
you want to look at GeneratorURL:
https://prometheus.io/docs/alerting/notifications/#alert
> --
> 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/d2374036-e574-44b7-99d8-e96b4b93dc15%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages