Module 9 · Project 09 · Monitor It with Prometheus and Grafana · Lesson 32 of 48

Alerts, SLOs and on-call

Write alerts that fire on real user pain, route them with Alertmanager, and use SLOs and error budgets to decide what matters.

In this lesson · about 30 minutes

  • Write a Prometheus alert rule with a for window
  • Route and silence alerts with Alertmanager
  • Define an SLI and SLO and work out an error budget

An alert rule

groups:
  - name: notes-api
    rules:
      - alert: HighErrorRate
        expr: |
          sum(rate(http_requests_total{status=~"5.."}[5m]))
            / sum(rate(http_requests_total[5m])) > 0.05
        for: 3m                   # must stay true this long
        labels:
          severity: page
        annotations:
          summary: "notes-api error rate above 5%"
          runbook: "https://wiki.example.com/runbooks/notes-api-errors"

The for window is what you saw in the simulator: the rule first goes pending, and only fires if it's still true after 3 minutes. Short blips never wake anyone.

Alertmanager

Prometheus sends firing alerts to Alertmanager, which decides who hears about them:

  • Routing: severity: page goes to the on-call phone (PagerDuty, Opsgenie); severity: ticket goes to a Slack channel.
  • Grouping: fifty Pods failing at once become one notification, not fifty.
  • Inhibition: if the whole cluster is down, don't also send every app's alert.
  • Silences: mute an alert during planned maintenance.

Good alerts

  • Alert on symptoms users feel (errors, slowness), not on every cause (one Pod restarted, CPU at 80%). Causes go on dashboards.
  • Every page must be urgent and actionable. If the right response is "ignore it", delete the alert.
  • Every alert links to a runbook: what it means, how to check, how to fix, who to call.

Too many alerts lead to alert fatigue: people stop reading them, and miss the one that matters.

SLIs, SLOs and error budgets

  • SLI (service level indicator): a measurement of user happiness, such as "share of requests that succeed in under 300ms".
  • SLO (objective): the target for it, such as "99.5% over 30 days".
  • Error budget: what's left over. 100% − 99.5% = 0.5% of requests may fail. Over 30 days that's about 3.6 hours of full downtime.

While budget remains, the team ships features. When it's nearly spent, the team slows releases and fixes reliability. That turns "is it reliable enough?" into a number everyone agrees on. An SLA is a promise to customers, usually with money back if it's missed, so it's set looser than the SLO.

Whiteboard · watch and try

Work out an error budget

Press Play, then try the last one yourself.

5 steps
Press Play and the tutor will talk you through it while writing on the board. Pause any time to write on the board yourself.

Tip: press Pause, then use the pen to work along on the board. Space plays and pauses; Ctrl+Z undoes your last mark.

Check your understanding0 of 3 correct

Question 1

1.What does for: 3m in an alert rule do?

Question 2

2.Which is the better page-worthy alert?

Question 3

3.An SLO is 99.9% over 30 days. Roughly how much downtime is the budget?

Key terms

Say the meaning to yourself, then tap a card to check.

Quiz score: 0 of 3

Tip: answer every quiz question correctly first.

Written by Noviq Academy in its own words. The labs are simulations: no real servers are touched. When you build the projects yourself, use a practice virtual machine or a free-tier cloud account you control, watch your cloud spending, and never run cleanup or delete commands on a machine you care about. Tool names belong to their owners; versions and output are shown for learning and may differ slightly from yours. Read-aloud and the whiteboard voice use your device's built-in voices.