-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Regex parsing issues in matchers for expressions broken down into multiple lines. #4470
Copy link
Copy link
Closed
Description
Alertmanager version 0.28.1
It appears that if the regex expression is broken into multiple lines, when the new line starts with .* it breaks things.
amtool config check doesn't result in any errors, no error logs when running the "broken regex" config file.
In the example bellow it doesn't match anything .*BGP.* and anything after it.
- matchers:
- team = "netops"
routes:
- matchers:
- alertname =~ "ping_fail|PeerDownORFlappingJuniper|ServiceMonitorLowAvailability|ReadOnlyFileSystem|
PowerSupplyBad.*|*|TooMuchTrafficTowardsLBorFW|BGPTooManySessionsDown.*|BGPDrained.*|
.*BGP.*|FanStateBad.*|NodeLowFreeMem|InputDiscardsHighSonic|TempHigh.*|
TempHigh.*|.*Interface.*|.*ErrorsRate.*"
receiver: abc
continue: true
This is working as expected
- matchers:
- team = "netops"
routes:
- matchers:
- alertname =~ "ping_fail|PeerDownORFlappingJuniper|ServiceMonitorLowAvailability|ReadOnlyFileSystem|
PowerSupplyBad.*|*|TooMuchTrafficTowardsLBorFW|BGPTooManySessionsDown.*|BGPDrained.*|
FanStateBad.*|NodeLowFreeMem|InputDiscardsHighSonic|TempHigh.*|.*BGP.*|
TempHigh.*|.*Interface.*|.*ErrorsRate.*"
receiver: abc
continue: true
To test, "bad" regex string:
./amtool config routes test --config.file=alertmanager-config.yml alertname=BGPAdminDown team=netops production_state=production severity=info
receiver_A,netops-info
"normal" regex string:
./amtool config routes test --config.file=alertmanager-config.yml alertname=BGPAdminDown team=netops production_state=production severity=info
receiver_A,abc,netops-info
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels