wildcards not working in alertmanager.yml

32 views
Skip to first unread message

Evelyn Pereira Souza

unread,
Aug 30, 2021, 3:31:59 AM8/30/21
to Prometheus Users
Hi

routes:
- match:
channel: iii
receiver: yyy
# mute_time_intervals:
# - Maintenance
- match:
cluster: devtest
receiver: "null"
- match:
cluster: poc
receiver: "null"
(...)
- match:
pod: "batch.+"
receiver: "null"
- match:
replicaset: "data-sync.+"
receiver: "null"
- match:
deployment: data-sync
receiver: "null"

The wildcards (example data-sync.+ and batch.+) not working. Only static
values working.

kind regards
Evelyn
OpenPGP_0x61776FA8E38403FB.asc
OpenPGP_signature

Brian Candler

unread,
Aug 30, 2021, 7:35:50 AM8/30/21
to Prometheus Users
"match" matches exact strings.  You need "match_re" if you want to match regular expressions.


Note also that "null" matches the exact string "null".  Is that what you want?  In other words, have you set a label called "receiver" with value "null" in your alerting rule?

Evelyn Pereira Souza

unread,
Aug 30, 2021, 1:26:50 PM8/30/21
to promethe...@googlegroups.com
On 30.08.21 13:35, Brian Candler wrote:
> "match" matches exact strings.  You need "match_re" if you want to match
> regular expressions.

thank you

from docs:

# DEPRECATED: Use matchers below.
# A set of regex-matchers an alert has to fulfill to match the node.
match_re:

I need this?

# A list of matchers that an alert has to fulfill to match the node.
matchers:
[ - <matcher> ... ]


can you give me an example?

that's why I was confused

> See the documentation
> here: https://prometheus.io/docs/alerting/latest/configuration/#route
> and also the interactive testing tool
> here: https://prometheus.io/webtools/alerting/routing-tree-editor/
>
> Note also that "null" matches the exact string "null".  Is that what you
> want?  In other words, have you set a label called "receiver" with value
> "null" in your alerting rule?

yes. Those alerts I wish to send to /dev/null

kind regards
Evelyn

OpenPGP_0x61776FA8E38403FB.asc
OpenPGP_signature

Brian Candler

unread,
Aug 30, 2021, 2:54:39 PM8/30/21
to Prometheus Users
Ah right, I wasn't aware of the new syntax (although match_re will still work)

There's an example of matchers with regular expression here: https://prometheus.io/docs/alerting/latest/configuration/#matcher

matchers:
  - '{quote=~"She said: \"Hi, all!( How're you…)?\""}'

> > Note also that "null" matches the exact string "null".  Is that what you
> > want?  In other words, have you set a label called "receiver" with value
> > "null" in your alerting rule?
> yes. Those alerts I wish to send to /dev/null

Ah I see, it's because your formatting was broken in your original post.

You wrote:

- match:
replicaset: "data-sync.+"
receiver: "null"


I think you meant:

- match:
    replicaset: "data-sync.+"
  receiver: "null"


That is, you're not matching on a label called "receiver" with value "null"; you're setting the receiver to "null".  That's perfectly OK.
Reply all
Reply to author
Forward
0 new messages