What Is a Runbook? Writing Runbooks That Help
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.
- 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.
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.
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
- From Runbook to Robot: Executable Runbooks as Code: runbooks written as code, with pre-checks, dry runs and approval gates, the next step after this lesson.
- RAG 101: Build Your First RAG Pipeline over Runbooks: an AI assistant that answers on-call questions from your runbooks and cites its sources.