Monitoring and alerts
Goal
Make sure a human is woken only when users are hurt or about to be, and has what they need to act.
A good alert set is small, each alert has an owner and a first step, and silence means healthy.
When to use
- A new service needs monitoring before launch.
- The on call gets pages nobody acts on.
- An outage was found by users before the alerts.
- For health endpoints that monitors call, use
use_skillwithhealth-checks.
Steps
- Find what exists. Use
rgfor alert rule files,prometheus,datadog,grafanaandalertmanager, and read them withread_file. - Ask with
ask_userwhat the user journeys are and what the service promises: availability, latency, freshness. Do not invent targets. - Pick signals per service: request rate, error rate, latency percentiles, saturation (CPU, memory, disk, connections, queue depth). Add job freshness for batch work.
- Write symptom alerts first (error ratio, slow requests, failed checkouts). Add cause alerts (disk filling) only when they give lead time.
- Set each threshold from observed data. Use
run_commandto query metrics or logs for a typical week, then choose a value above normal peaks. - Add a duration (
for:or evaluation window) so a single spike does not page. Use rate based or burn rate rules over raw counts. - Add alerts for the monitor itself: a missing data alert and a heartbeat from a dead man's switch.
- Assign a severity: page now, ticket next day, dashboard only. Route by severity and by owner.
- Attach to each alert a summary, the dashboard link and the runbook link or first three checks.
- Review existing alerts: list those that fired often with no action and propose delete, raise threshold, or turn to ticket.
- Write rule files with
create_filein the format the user's tool uses. Check syntax docs withread_urlwhen unsure. - Test with a deliberate failure in staging or by replaying data, and confirm the page reaches a person.
Gotchas
- Alerting on CPU above a number pages for healthy busy servers and misses a broken app with idle CPU.
- Averages hide the slow tail. Use percentiles for latency, and know the metric is per instance or aggregated.
- If a service has zero traffic, an error ratio is undefined and the alert may never fire or always fire. Handle empty data.
- Alerts without a runbook mean the person at 3 am starts from zero.
- A monitor that lives on the same host or network as the service goes down with it.
- Copied thresholds from a blog post do not match this service. Measure first.
Output
- A table of alerts: signal, condition, duration, severity, owner, runbook.
- Alerts to remove or downgrade with reasons.
- Rule files created, and the failure test result or that it was not run.
