Course contents · Lesson 18 of 19

What Is a Runbook? Writing Runbooks That Help

Safe Change · Lesson 18 of 19 · 10 min Engineer

Your phone buzzes at 3:10 a.m.: DiskAlmostFull on db-2, your shop's database server. Last month a teammate cleared the same alert by "deleting old logs", but which logs? Delete the wrong files and the database may not recover. The teammate is asleep, and you have minutes. This lesson answers what is a runbook: what goes in one, how to write steps that work under pressure and how to keep them accurate.

What a runbook is

A runbook is a short document that tells whoever is on call what an alert means and what to do about it. Some teams, Google among them, call it a playbook. Its reader holds the pager (lesson 13) and may be new, half awake and unfamiliar with the system that broke.

Google's SRE book reports that a playbook written in advance gives roughly a three times improvement in MTTR (mean time to repair, the average time from a failure to its fix) compared with "winging it".

A runbook is not a design document or a tour of the system: it answers one question for one alert, what do I do now? That keeps it short enough to read on a phone.

Anatomy of a runbook

Good runbooks use the same sections in the same order, so you can find your place under pressure. In the template for the disk alert, notice that cheap, safe checks come before the fix, and the page ends with proof that you are done.

Example runbook page with illustrative values. Header: Runbook DiskAlmostFull for db-2, the shop's database server; owner database team; last tested 12 Nov 2026 on a game day. Six numbered sections. 1, Trigger: DiskAlmostFull on db-2, fires at under 10 percent free for 10 minutes. 2, Impact: disk full means new orders cannot be saved, so checkout fails until space is freed. 3, Quick checks: df -h /var/lib/postgresql; Use% above 90 percent means the alert is real. 4, Mitigation: delete server logs older than 7 days, with a warning never to delete anything in pg_wal. 5, Escalation: still above 90 percent after 15 minutes, page the database team's on-call. 6, Confirm the fix: Use% under 90 percent and the checkout SLI healthy, then note it in the handover
Same six questions, same order: the reader always knows where to look.
  • Trigger: the alert's exact name, so a search finds the runbook at once.
  • Impact: what users feel if nobody acts, which tells you how fast to move.
  • Quick checks: a few fast, read-only commands that confirm the problem is real.
  • Mitigation: steps that stop the harm (lesson 12), with any dangerous step clearly marked.
  • Escalation: who to page next, and after how long, if the steps do not work.
  • Confirm the fix: the measurement that proves users are fine, such as an SLI (lesson 5), not just that a command ran.

During a page you walk the sections in order. In the flowchart, notice that a healthy first check ends early, and that escalating is a planned exit, not a failure.

Flowchart. The alert DiskAlmostFull on db-2 fires. Open the runbook linked in the page. Run check 1, df -h /var/lib/postgresql. Decision: healthy, meaning Use% under 90 percent? Yes leads to confirm and close: SLI healthy again, note it in the handover, and tune the alert if it was a false alarm. No leads to apply the fix, delete old server logs. Second decision: still failing when you re-run check 1? No leads to confirm and close. Yes leads to escalate: page the database team's on-call. Side notes map each step to a runbook section, check to quick checks, fix to mitigation, escalate to escalation, close to confirm the fix, and say that escalating on time is a planned step, not a failure
Every exit was decided in advance, including when to stop trying and call for help.

Writing steps that help

Write every step for someone who has never seen the system. Four habits do most of the work:

  • Exact commands. Give the full command with real host names and paths, ready to copy and paste. Typing from memory at 3 a.m. invites typos.
  • Expected output. Show what healthy output looks like and what each bad result means, so the reader knows where to go next.
  • No assumed knowledge. Say where to run each command and what access it needs, link the dashboard and spell out dangers. The template forbids touching pg_wal: it holds PostgreSQL's write-ahead log (WAL), the record of recent changes the database replays to recover after a crash.
  • An owner and a date. Name the team that keeps it current and when it was last tested, so readers can judge how far to trust it.

The diagram rewrites one vague step. Notice that the precise version answers the three questions the vague one leaves open: which database, how to check it and what counts as healthy.

Before and after. Before: step 2 says only check the database, leaving the reader to ask which database, check it how, and what counts as healthy. After: step 2, is db-2 accepting connections? Run from a machine with database access: pg_isready -h db-2 -p 5432. Expect this line: db-2:5432 - accepting connections. If it prints no response, go to escalation and page the database team. Footer: every result points to a next step
Someone who has never seen db-2 can follow the precise step.

pg_isready is PostgreSQL's connection check. It prints the host and port, then accepting connections, rejecting connections (for example while the server starts up) or no response. A full runbook gives each result its own next step.

Keeping runbooks alive

A wrong runbook is worse than none, because the reader trusts it. Unlike an aircraft checklist, a runbook has no regulator checking it, and the system changes under it every week.

Link it from the alert

As Alerting Best Practices showed, a Prometheus alert rule can carry the link in an annotation, a free-text field on the alert, so the page itself opens the right runbook. This excerpt from a rules file fires when the database disk, mounted at /var/lib/postgresql, has had under 10 percent free space for 10 minutes:

- alert: DiskAlmostFull
  expr: |
    node_filesystem_avail_bytes{mountpoint="/var/lib/postgresql"}
      / node_filesystem_size_bytes{mountpoint="/var/lib/postgresql"} < 0.10
  for: 10m
  labels:
    severity: page
  annotations:
    summary: "Under 10% disk free on {{ $labels.instance }}"
    runbook_url: "https://runbooks.example.com/db/disk-almost-full"

runbook_url is a common naming convention, not a built-in field, so check that your paging tool shows the link. Notice that the rule and the runbook draw the same line: under 10 percent free is about 90 percent used in df, a little less on disks with space reserved for root.

Test it on game days

On a game day (lesson 16), a planned practice session for failures, fill a disk on a test server and ask someone who has never used the runbook to follow it while the author watches. Every place they hesitate is a step to rewrite.

Update it after every incident

The postmortem (lesson 14) should ask whether the runbook helped and which step was wrong or missing; an action item fixes it. Each time a game day or a real page goes through it cleanly, update the "last tested" date.

From runbook to automation

Watch for steps that run the same way every time. Following them by hand is toil (lesson 3): manual, repetitive work a machine could do. Turn such steps into a script, then into auto-remediation: automation that runs the fix when the alert fires and pages a person only if the fix fails. The runbook stays, now explaining what the automation does, how to tell it failed and the manual steps for when it does.

Some decisions should stay with a person: actions that cannot be undone, such as deleting data or failing over to a replica that may lack the latest writes; symptoms that do not match the runbook; and fixes that trade one harm for another. For example, if db-2's space is going to pg_wal because copying WAL files to backup storage keeps failing, deleting old logs will not help. Automation can still gather the evidence and ask a human to approve the next step.

Check yourself

A runbook step says "Restart the service if it looks unhealthy." What would you add so a new teammate can follow it at 3 a.m.?

The exact command, with the service and host names, and what healthy and unhealthy output look like. Without them the reader must guess what to run and when.

On a game day, a new teammate gets stuck at step 2 of the disk runbook because the log folder has moved. Did the game day fail?

No: it found a stale step while nobody was being hurt. Fix it now, before a real 3 a.m. page hits the same gap.

The fix in your disk runbook, deleting old server logs, has worked unchanged on the last 20 pages. What should happen next, and what should stay with a person?

Automate it, because repeating identical steps by hand is toil. Keep a person for cases the script cannot judge, such as space going to pg_wal or a failover that could lose data.

Go deeper