Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alertmanager Match vs Match_re

match:
  [ <labelname>: <labelvalue>, ... ]

# A set of regex-matchers an alert has to fulfill to match the node.
match_re:
  [ <labelname>: <regex>, ... ]

My question is what is the difference between a match and a match_re statement? I have used both of the within prometheus and the effect they have is the same.

Any help is very much appreciated!!

like image 248
zemmer W Avatar asked Jun 08 '26 00:06

zemmer W


2 Answers

With "match_re" you can use regular expression like in the following examples:

service: "mysql|postgre"

system: ".*_(foo|boo)$"

recipient: "(.*,)?customer/sms(,.*)?"

alertname: "watchdog.*alert"
like image 123
Marcelo Ávila de Oliveira Avatar answered Jun 10 '26 17:06

Marcelo Ávila de Oliveira


From the v0.22.2 both match and match_re are deprecated in favor of matchers. A nice new feature is the possibility to define negative matchers.

# DEPRECATED: Use matchers below.
# A set of equality matchers an alert has to fulfill to match the node.
match:
  [ <labelname>: <labelvalue>, ... ]

# DEPRECATED: Use matchers below.
# A set of regex-matchers an alert has to fulfill to match the node.
match_re:
  [ <labelname>: <regex>, ... ]
  
# A list of matchers that an alert has to fulfill to match the node. 
matchers:
  [ - <matcher> ... ]

Source

like image 20
Kattia Avatar answered Jun 10 '26 18:06

Kattia