"Conditional" alert groups in Alertmanager

132 views
Skip to first unread message

Gautam Gupta

unread,
Jun 27, 2023, 2:05:16 AM6/27/23
to Prometheus Users
Hi,
Is there a way to default to the behavior of `group_by: ["..."]` (i.e. no grouping) while configuring an optional label to act as a "grouping" key?

Maybe a better way to phrase is is that I'd like `group_by: ["alertname", "group"]` to group alerts by the `group` label when it is present, but to treat alerts as distinct if the label is not present.

I think right now my only workaround is to duplicate my receivers to have separate `group_by` configs, and then route to them depending on the presence of the `group` label.

The use case is that for most of my alerts, I'd like to be notified for each distinct occurrence, but a few of them are likely to fire across the entire fleet at once and I'd like those to be grouped together. Not sure if there's another way to accomplish this. 

Julius Volz

unread,
Jun 27, 2023, 2:46:55 AM6/27/23
to Gautam Gupta, Prometheus Users
Hi Gautam, I believe you're correct. Since the grouping is determined on a (sub)route level, having a top-level switch on the "group" label and then duplicating things below that seems to be the best way to achieve this.

--
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/5f1dced4-13ca-45b8-9dca-04ad891b10f5n%40googlegroups.com.


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