🎓 A1Learner
🔍
0 of 50 lessons completed

Alertmanager: Inhibition and Silences

Inhibition is a rule that hides a less urgent alert when a more urgent one about the same thing is already firing. A silence is a timed pause on chosen alerts, used during planned work like a deploy.

The inhibit rule

A critical alert for a job hides the warning alert for the same job.

inhibit_rules:
  - source_matchers:
      - severity = "critical"
    target_matchers:
      - severity = "warning"
    equal: ['job']

Add a silence for a deploy

This silence pauses all warning alerts for 30 minutes.

amtool silence add --comment "Deploy window" --author "leg-d" --duration 30m 'severity="warning"'

List the silences

This command shows every active silence and when each one ends.

amtool silence query

Example

amtool silence add --comment "Deploy window: testing silences" --author "leg-d" --duration 30m 'severity="warning"'

Key points

  • Inhibition stops the noise: when ShopSentry is down, the high error rate warning adds nothing.
  • An inhibit rule names a source alert and a target alert by their labels.
  • The equal list names the labels that must match for the inhibition to apply.
  • In this course the source is severity critical and the target is severity warning, equal on job.
  • A silence matches alerts by labels too, and it ends on its own when its time runs out.
  • A silence during a deploy stops pages for a known change, not for a real failure.
  • Every silence carries who made it and why, so the pause is never a mystery.

In this example, amtool adds a real silence to the running Alertmanager and prints its id. The silence matches every warning alert and ends 30 minutes later, at 00:21:50 UTC. While it lasts, warning alerts still fire in Prometheus but no warning notification is sent.

Note

A silence hides the notification, never the alert. Prometheus still shows the alert as firing.

Try it Yourself

Edit the code, then press Run.

Running is simulated · Rust Playground

Exercise

What is the difference between inhibition and a silence?