Hi Bohr, Alertmanager can only group and route on labels that are part of the alert labels. It has no other concept of "namespaces" or such, it just knows about arbitrary labels that are attached to the incoming alerts. So you will need to ensure on the Prometheus side that your alerting rules preserve the "namespace" label everywhere if you want to route alerts based on it in Alertmanager. In general it's a good practice to not aggregate away any labels in alerting rules that you don't want to explicitly get rid of, so that you still have that information in Alertmanager.
Regards, Julius On Thu, Jan 14, 2021 at 8:27 PM Bohr Zhong <[email protected]> wrote: > Anyone knows how to configure alermanager routing to filter the alerts > from different namespace into different targets? > > something like: > match: > namespace: teamA > receiver: teamA-pagerduty > continue: true > > But namespace is not part of alert labels. Alerts are created from > kube-state-metrics but we would like to group the alerts based on the > namespace. and route to a different pager duty endpoint. > > > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/prometheus-users/e673ac15-59bd-422f-bd07-d22b534d67b7o%40googlegroups.com > <https://groups.google.com/d/msgid/prometheus-users/e673ac15-59bd-422f-bd07-d22b534d67b7o%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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CAObpH5y4BHuepwJaK8JNL3m%3D_XdWCxuCdBHfx-jh4re1jeUc-Q%40mail.gmail.com.

