Alerting and Incident Response
Good alerts, avoiding alert fatigue, on-call, the incident lifecycle, and automated responses.
What makes a good alert
An alert should wake someone up only when a person needs to act, now. Too many alerts, and people stop paying attention; too few, and users find the problems first. Good alerting, a clear on-call process, and a learning culture after incidents are what turn monitoring data into reliable databases.
Every alert should pass three tests:
- Actionable
- There's something a person can and should do. "CPU was briefly at 95%" usually isn't; "orders are failing" is.
- Urgent enough for its channel
- Pages are for problems that need action within minutes. Everything else goes to a ticket or a chat channel to handle in working hours.
- Documented
- Every alert links to a runbook that says what it means, how to check, and how to fix it.
| Severity | Example | Goes to |
|---|---|---|
| Critical: page now | Production database down; SLO error budget burning fast; replication broken on the primary's only standby | The on-call DBA's phone, any time |
| Warning: act today | Tablespace 90% full and growing; backup failed once; standby lag rising | A ticket or team channel, in working hours |
| Info: no action | Failover test completed; patch applied | Logs and dashboards only |
Alert fatigue
When people receive dozens of alerts a day, most of them unimportant, they start to ignore them, and eventually miss the one that matters. This is alert fatigue, and it's one of the most common monitoring problems in DBA teams. Ways to avoid it:
- Alert on symptoms, not causes. Page on "order inserts are slow", the thing users feel, rather than every possible cause, such as high CPU, which may be harmless.
- Use durations. Alert only if a condition lasts, such as 15 minutes, so brief spikes don't page anyone.
- Alert on SLO burn rate. Instead of a fixed threshold, page when the error budget is being used up much faster than normal, for example fast enough to use a whole month's budget in two days. Slow burns become tickets.
- Review alerts regularly. Delete or downgrade alerts that never lead to action, and fix the causes of alerts that fire repeatedly, often by automating the fix.
On-call
- A rota: one primary and one backup on call each week, rotated fairly, with handovers that cover open issues.
- Escalation: if the primary doesn't acknowledge a page within a few minutes, it goes to the backup, then the team lead.
- Runbooks: step-by-step guides for common alerts, kept in Git and improved after each use. Where a runbook's steps are always the same, they're a candidate for automation.
- Sustainability: time off after a bad night, and a team that treats a heavy on-call load as a problem to fix, not a badge of honor.
The incident lifecycle
- Mitigate first, then fix
- During an incident, the priority is restoring service, such as failing over to a standby, rolling back a release, or ending a blocking session, even if the root cause isn't understood yet. The full fix can follow once users are back.
- Incident roles
- For larger incidents, one person, the incident commander, coordinates and communicates, while others investigate and fix. It stops everyone talking at once and makes sure stakeholders get updates.
- Blameless postmortems
- A written review of what happened, the timeline, the impact, why it happened, and what will change, focused on the system rather than on blaming people, as covered in Database Reliability Engineering.
Automated responses
Some alerts always lead to the same safe fix. Those are candidates for auto-remediation: the alert triggers automation, such as Event-Driven Ansible or a runbook automation tool, that applies the fix and records what it did, paging a person only if the fix doesn't work. Common database examples:
- Adding a data file when a tablespace is nearly full, within agreed size limits.
- Restarting a failed listener or monitoring agent.
- Rerunning a failed backup, then alerting if it fails again.
- Collecting diagnostics, such as an ASH report or a list of blocking sessions, the moment an alert fires, so the DBA has them when they log in.
Key takeaways
- Good alerts are actionable, sent through a channel that matches their urgency, and linked to a runbook.
- Avoid alert fatigue: alert on symptoms, use durations, alert on SLO burn rate, and review alerts regularly.
- On-call needs a fair rota, escalation, runbooks, and a manageable load.
- Incidents follow a lifecycle: detect, triage, mitigate, resolve, review, and improve.
- Repetitive, safe fixes can be automated, with a person paged only when automation can't fix the problem.