how can I get rule group name in alert_relabel_configs

55 views
Skip to first unread message

chen sr

unread,
Nov 23, 2022, 5:21:49 AM11/23/22
to Prometheus Users
I want to defined serverity level by group name , for example:
rule file:
    groups:
     - name: critical_for_xxx
        rules:
         - alert: xxxx
     - name: waring_for_xxx

alerting:
    alert_relabel_configs:
     - source_labels: [ ... ]
        regex: (critical).+
        target_label: serverity
        replacement: critical
what it needs in source_labels [  ] to regex rule name to match?

Julius Volz

unread,
Nov 24, 2022, 3:47:21 PM11/24/22
to chen sr, Prometheus Users
There's no way to get at the rule group name unfortunately.

There is a pending PR however to allow you to set common labels for alerts within a group: https://github.com/prometheus/prometheus/pull/11474. If that was merged (looking into it), then you could set a common severity label and route on that.

--
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/7a235498-d3a6-4fb6-9847-3488edc31f04n%40googlegroups.com.


--
Julius Volz
PromLabs - promlabs.com
Reply all
Reply to author
Forward
0 new messages