Update matcher examples

While the documentation for the matchers themselves was updated, we
missed the examples.

I propose to merge this into the release-0.22 branch so that it gets
included in the ongoing release.

Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
beorn7 2021-05-06 19:17:25 +02:00
parent fc9f728167
commit 0ed31c3311
2 changed files with 25 additions and 27 deletions

View File

@ -47,39 +47,39 @@ route:
routes:
# This routes performs a regular expression match on alert labels to
# catch alerts that are related to a list of services.
- match_re:
service: ^(foo1|foo2|baz)$
- matchers:
- service=~"foo1|foo2|baz"
receiver: team-X-mails
# The service has a sub-route for critical alerts, any alerts
# that do not match, i.e. severity != critical, fall-back to the
# parent node and are sent to 'team-X-mails'
routes:
- match:
severity: critical
- matchers:
- severity="critical"
receiver: team-X-pager
- match:
service: files
- matchers:
- service="files"
receiver: team-Y-mails
routes:
- match:
severity: critical
- matchers:
- severity="critical"
receiver: team-Y-pager
# This route handles all alerts coming from a database service. If there's
# no team to handle it, it defaults to the DB team.
- match:
service: database
- matchers:
- service="database"
receiver: team-DB-pager
# Also group alerts by affected database.
group_by: [alertname, cluster, database]
routes:
- match:
owner: team-X
- matchers:
- owner="team-X"
receiver: team-X-pager
continue: true
- match:
owner: team-Y
- matchers:
- owner="team-Y"
receiver: team-Y-pager
@ -88,16 +88,14 @@ route:
# We use this to mute any warning-level notifications if the same alert is
# already critical.
inhibit_rules:
- source_match:
severity: 'critical'
target_match:
severity: 'warning'
- source_matchers: [ severity="critical" ]
target_matchers: [ severity="warning" ]
# Apply inhibition if the alertname is the same.
# CAUTION:
# If all label names listed in `equal` are missing
# from both the source and target alerts,
# the inhibition rule will apply!
equal: ['alertname', 'cluster', 'service']
equal: [ alertname, cluster, service ]
receivers:

View File

@ -211,15 +211,15 @@ route:
# are dispatched to the database pager.
- receiver: 'database-pager'
group_wait: 10s
match_re:
service: mysql|cassandra
matchers:
- service=~"mysql|cassandra"
# All alerts with the team=frontend label match this sub-route.
# They are grouped by product and environment rather than cluster
# and alertname.
- receiver: 'frontend-pager'
group_by: [product, environment]
match:
team: frontend
matchers:
- team="frontend"
```
## `<mute_time_interval>`