From f5b7cd44f9a0837f3346d04d72aaef69f5cba18a Mon Sep 17 00:00:00 2001 From: turanisl Date: Thu, 29 Oct 2026 00:48:46 +0000 Subject: [PATCH] Add Chapter 5 alerting and incident response runbook --- monitoring/ALERTING-RUNBOOK.md | 326 +++++++++++++++++++++++++++++++++ 1 file changed, 326 insertions(+) create mode 100644 monitoring/ALERTING-RUNBOOK.md diff --git a/monitoring/ALERTING-RUNBOOK.md b/monitoring/ALERTING-RUNBOOK.md new file mode 100644 index 0000000..2c71b84 --- /dev/null +++ b/monitoring/ALERTING-RUNBOOK.md @@ -0,0 +1,326 @@ +# Chapter 5 — Alerting and Incident Response Runbook + +## 1. Purpose + +This runbook defines the monitoring alerts, response procedures, +controlled outage experiment, recovery verification, and evidence +required for Chapter 5. + +The monitoring stack consists of Prometheus, Grafana, Node Exporter, +and Blackbox Exporter. + +All monitoring services must be deployed without exposing their +internal ports publicly. + +The existing Gitea, Jenkins, and Caddy services must be preserved. + +## 2. Alert A — HTTPS Availability Failure + +Alert name: HTTPS Service Unavailable + +Monitoring system: Grafana-managed alerting + +Data source: Prometheus + +PromQL: + +probe_success{job="https"} + +Condition: + +- Evaluate each HTTPS target independently. +- Trigger when probe_success is below 1. +- Pending period: 1 minute. +- Evaluate every 30 seconds where supported. +- Alert separately for Gitea and Jenkins using the instance label. + +Expected behavior: + +- A successful probe returns 1. +- A failed probe returns 0. +- Sustained failure transitions the alert to Firing. +- Recovery transitions the alert to Normal or Resolved. + +Important: + +Missing probe data must not automatically be interpreted as +successful service availability. + +The team must inspect No Data behavior separately. + +Jenkins monitoring requests must be permitted through the +existing Caddy IP allowlist without weakening Jenkins security. + +HTTP 403 must not count as a successful Jenkins probe. + +## 3. Alert B — Low Root Disk Space + +Alert name: Host Root Disk Space Low + +Monitoring system: Grafana-managed alerting + +Data source: Prometheus + +PromQL: + +100 * +node_filesystem_avail_bytes{ + job="node-exporter", + mountpoint="/", + fstype!~"tmpfs|overlay" +} +/ +node_filesystem_size_bytes{ + job="node-exporter", + mountpoint="/", + fstype!~"tmpfs|overlay" +} + +Condition: + +- Trigger when available root disk space is below 15%. +- Pending period: 5 minutes. +- Evaluate every 30 seconds where supported. + +Expected behavior: + +- Normal when available disk space is at least 15%. +- Pending when the threshold is crossed. +- Firing after five continuous minutes below the threshold. +- Resolved after the condition clears. + +## 4. Notification Contact Point + +Configure a Grafana contact point approved by the team. + +The destination may be email or another supported notification +channel. + +Do not commit passwords, API tokens, or notification secrets +to the repository. + +Required evidence: + +- Contact point configuration. +- Successful test notification. +- Actual alert notification received. +- Alert resolution notification where supported. + +Record the notification destination in the final manual without +exposing private credentials. + +## 5. HTTPS Failure Response Procedure + +When the HTTPS alert fires: + +1. Record the UTC timestamp. +2. Identify the affected instance label. +3. Check the corresponding Grafana dashboard panel. +4. Inspect Prometheus probe_success and probe_duration_seconds. +5. Check whether the HTTPS endpoint returns HTTP 200. +6. Check TLS certificate validity. +7. Check the relevant Docker container status. +8. Inspect relevant container logs. +9. Confirm whether the issue is application failure, proxy access, + DNS, TLS, or monitoring configuration. +10. Restore service using the approved recovery procedure. +11. Verify probe_success returns to 1. +12. Record the recovery timestamp and alert resolution. + +Do not disable security controls merely to silence an alert. + +## 6. Low Disk Space Response Procedure + +When the disk alert fires: + +1. Record the UTC timestamp. +2. Confirm root disk availability using Node Exporter metrics. +3. Check disk usage on the host. +4. Identify unusually large files, logs, images, or volumes. +5. Do not delete Docker volumes without identifying their owners. +6. Preserve Gitea, Jenkins, and monitoring persistent data. +7. Apply an approved cleanup or capacity increase. +8. Verify disk availability returns above the threshold. +9. Record the alert resolution. + +Do not use destructive cleanup commands without approval. + +## 7. Safe Disk Alert Demonstration + +The team must not fill the Droplet disk to trigger the alert. + +Instead: + +1. Record the actual root disk available percentage. +2. Temporarily raise the alert threshold above that value. +3. Wait for the configured five-minute pending period. +4. Capture Pending and Firing evidence. +5. Verify notification delivery. +6. Restore the required 15% threshold. +7. Confirm the alert returns to Normal or Resolved. +8. Record the temporary threshold and restoration time. + +This is a controlled alert test, not a genuine disk exhaustion event. + +## 8. Controlled Jenkins-Only Outage + +The controlled outage must affect Jenkins only. + +Do not stop Gitea, Caddy, or the monitoring stack. + +Before starting: + +1. Confirm Gitea and Jenkins probes are healthy. +2. Confirm both Grafana panels show valid data. +3. Confirm the HTTPS alert is operational. +4. Confirm the notification contact point works. +5. Record the UTC start time. + +During the experiment: + +1. Stop only the Jenkins application container using an + approved maintenance procedure. +2. Keep the outage approximately three minutes. +3. Record the first failed Jenkins HTTPS probe. +4. Record the alert Pending and Firing transitions. +5. Record notification receipt time. +6. Confirm Gitea continues to report successful probes. + +Recovery: + +1. Restart Jenkins using the approved procedure. +2. Confirm the Jenkins login endpoint responds successfully. +3. Confirm probe_success returns to 1. +4. Confirm the Grafana alert resolves. +5. Record the UTC recovery time. +6. Verify Jenkins pipeline functionality. +7. Verify the Gitea Actions PDF workflow independently. + +The team must coordinate this outage and obtain approval +before disrupting Jenkins. + +## 9. Incident Timeline + +Record actual UTC timestamps for: + +- Planned maintenance approval. +- Jenkins stop command. +- First failed probe. +- Alert Pending state. +- Alert Firing state. +- Notification receipt. +- Jenkins restart command. +- First successful probe. +- Alert resolution. +- Jenkins pipeline verification. +- Gitea Actions PDF verification. + +Do not invent timestamps. + +## 10. Detection and Recovery Measurements + +Detection delay: + +First failed probe time - Jenkins outage start time + +Alert firing delay: + +Alert Firing time - First failed probe time + +Notification delay: + +Notification receipt time - Alert Firing time + +Service recovery time: + +First successful probe time - Jenkins outage start time + +These measurements must use actual recorded timestamps. + +Distinguish application recovery from alert resolution. + +## 11. Prometheus and Grafana Restart Tests + +Perform these tests separately after the monitoring stack +has been deployed and verified. + +Prometheus restart: + +1. Record current targets and metrics. +2. Restart only Prometheus. +3. Confirm the service returns. +4. Confirm historical time-series data persists. +5. Confirm scrape targets recover. + +Grafana restart: + +1. Record the dashboard and data source. +2. Restart only Grafana. +3. Confirm HTTPS login works. +4. Confirm the provisioned dashboard remains available. +5. Confirm the alert rules and contact points persist. + +Do not delete persistent volumes during these tests. + +## 12. Blameless Incident Review + +The incident review must include: + +- Incident summary. +- Intended experiment. +- Actual impact. +- Timeline. +- Detection behavior. +- Notification behavior. +- Recovery behavior. +- What worked. +- What did not work. +- Contributing technical factors. +- Preventive improvements. +- Evidence references. + +Focus on system behavior and improvement rather than +assigning personal blame. + +## 13. Follow-Up Gitea Issues + +Create at least two follow-up issues after the experiment. + +Each issue must include: + +- Specific improvement. +- Assigned owner. +- Priority. +- Acceptance criteria. +- Link to the incident review. + +Possible improvements include: + +- Strengthening Jenkins HTTPS monitoring access. +- Improving alert notification delivery. +- Adding monitoring deployment automation. +- Improving restart and recovery documentation. + +Do not claim issues exist until they have been created. + +## 14. Required Evidence + +Capture: + +- Grafana HTTPS login. +- Six-panel dashboard. +- Alert rules and evaluation settings. +- Notification contact point. +- Test notification. +- HTTPS alert Pending and Firing. +- Disk alert Pending and Firing. +- Jenkins outage and recovery. +- Gitea remaining healthy during Jenkins outage. +- Actual notification receipt. +- Prometheus persistence after restart. +- Grafana persistence after restart. +- Jenkins pipeline verification. +- Gitea Actions PDF workflow verification. +- Two follow-up Gitea issues. + +Evidence must reflect actual execution, not planned behavior. \ No newline at end of file