1. Silences #
Muting temporarily.
With amtool #
export ALERTMANAGER_URL=http://localhost:9093 # ou --alertmanager.url
# Créer un silence de 2 h pour la maintenance d'une base
amtool silence add instance="db-1:9100" --duration=2h \
--author="martin" --comment="Maintenance planifiée CHG-1234"
amtool silence query # lister les silences actifs
amtool silence query -e # y compris expirés
amtool silence expire <id> # lever un silence
amtool alert query # alertes actives (non silencées)A silence is a set of matchers and a time period. Matching alerts remain visible in the interface (marked silenced) but are no longer notified.
Common mistake: A silence that is too broad (severity=~".*") can hide a real incident for hours. Always limit a silence to one instance or service, with a short duration and a comment citing the change ticket.2. Inhibitions #
One cause, one alert.
Principle #
When an entire datacenter is unreachable, there is no point receiving 300 « service down » alerts. An inhibition rule mutes target alerts as long as a source alert is active, provided they share the labels listed in equal.
inhibit_rules:
# Une alerte critique tait la même alerte en warning
- source_matchers: ['severity="critical"']
target_matchers: ['severity="warning"']
equal: [alertname, instance]
# Le cluster est injoignable : on tait toutes ses autres alertes
- source_matchers: ['alertname="ClusterUnreachable"']
target_matchers: ['alertname!="ClusterUnreachable"']
equal: [cluster]Good to know: The Alertmanager interface shows inhibited alerts with the Inhibited filter: useful to check that a rule is not too broad.
3. Time intervals #
Respecting the teams' sleep.
Business hours and freeze periods #
time_intervals:
- name: heures-ouvrees
time_intervals:
- weekdays: ['monday:friday']
times: [{ start_time: '09:00', end_time: '18:00' }]
location: Europe/Paris
- name: nuit-et-week-end
time_intervals:
- weekdays: ['saturday', 'sunday']
- times: [{ start_time: '18:00', end_time: '24:00' }, { start_time: '00:00', end_time: '09:00' }]
location: Europe/Paris
route:
receiver: defaut
routes:
- matchers: ['severity="warning"']
receiver: equipe-mail
mute_time_intervals: [nuit-et-week-end] # pas de warning la nuit
- matchers: ['severity="critical"']
receiver: astreinte # le critique sonne 24 h/24active_time_intervals does the opposite: the route is only active during the listed intervals (for example, a support channel open only during the day).
