"global" excludes in rules

10 views
Skip to first unread message

Evelyn Pereira Souza

unread,
Aug 26, 2021, 2:00:45 AM8/26/21
to Prometheus Users
Hi

I just copy those alerts

https://awesome-prometheus-alerts.grep.to/rules#kubernetes

I not wish to modify the individual alert (query). I wish to exclude
globally some namespaces and pods.

Is it possible to exclude some stuff, but not modify the individual
query I got from upstream?

kind regards
Evelyn
OpenPGP_0x61776FA8E38403FB.asc
OpenPGP_signature

Brian Candler

unread,
Aug 29, 2021, 3:59:25 AM8/29/21
to Prometheus Users
AFAIK, you have to modify the query.  However you can do it by adding to the query, leaving the original query unchanged, if you do something like this:

( original query ) and ( aux query )

where aux query returns a set of timeseries with the exact sets of labels that you want to alert on.  Or you can do the negative:

( original query ) unless ( aux query )

Using "on" and "ignoring" you can make the aux query smaller and simpler, e.g. just returning the sets of namespaces you are (or are not) interested in.

Personally though, I'd find it simpler just to add a condition to the original query. 
Reply all
Reply to author
Forward
0 new messages