diff --git a/monitoring/RUNBOOK.md b/monitoring/RUNBOOK.md new file mode 100644 index 0000000..72ea445 --- /dev/null +++ b/monitoring/RUNBOOK.md @@ -0,0 +1,65 @@ +# SSW 590 Monitoring Runbook + +Dashboard: https://metrics.ssw590-08.me/d/ssw590-sre +Contact point: `team-alerts` (email). Times are America/New_York. + +--- + +## ServiceUnavailable – Gitea or Jenkins HTTPS probe failing + +**Owner:** samahk13 (primary), kholmes (backup) +**Severity:** critical +**Fires when:** `probe_success{job="https"}` is 0 for an instance for at least 1 minute, +or the probe series is missing (no data) / the query errors. + +### 1. Acknowledge +Reply to the alert email (or post in the team chat) with "ack" and your name, and +note the time. This is the acknowledgement time in the incident timeline. + +### 2. Is it the service or the monitoring? +- Open the dashboard. Check the **Scrape health (up)** row. + - `blackbox` or `https` shows DOWN / no data → the **monitoring** is broken, + not necessarily the service. Go to step 5. + - `up` is 1 but panel 4 or 5 shows DOWN → the probed request failed. Continue. +- Open the URL in a browser: + - Gitea: https://git.ssw590-08.me/user/login + - Jenkins: https://ci.ssw590-08.me/login + +### 3. Check the container (SSH to the Droplet as root) +``` +docker ps -a --format 'table {{.Names}}\t{{.Status}}' +docker logs --tail=50 jenkins # or: gitea +docker logs --tail=50 caddy # proxy / TLS problems +``` + +### 4. Restore +- Container stopped/exited: + ``` + docker start jenkins # or: docker start gitea + ``` +- Container running but unhealthy: `docker restart jenkins` +- Certificate/proxy error: check `docker logs caddy`; validate with + `docker exec caddy caddy validate --config /etc/caddy/Caddyfile`. +- **Never** use `docker compose down -v` (deletes data volumes). + +Wait for the next probes (~30–60 s). The alert resolves when `probe_success` is 1 +again; confirm the "Resolved" email arrives. + +### 5. Monitoring itself is failing (no data / error) +``` +cd /root/Scrap-Web/monitoring +docker compose ps +docker compose logs --tail=50 prometheus blackbox-exporter +docker compose start prometheus blackbox-exporter +``` + +### 6. After recovery +- Jenkins: run **Build Now** on `main` and confirm it passes. +- Gitea: confirm the web login and that Jenkins can still post commit statuses. +- Record the timeline in the incident issue. + +--- + +## HostDiskLow – root filesystem below 15 % free + +**Owner:** kholmes — *(partner to complete)* diff --git a/monitoring/grafana/alerting/alert-rules.yaml b/monitoring/grafana/alerting/alert-rules.yaml new file mode 100644 index 0000000..a2cf970 --- /dev/null +++ b/monitoring/grafana/alerting/alert-rules.yaml @@ -0,0 +1,64 @@ +apiVersion: 1 +groups: + - orgId: 1 + name: availability + folder: SSW 590 + interval: 30s + rules: + - uid: fg2n29o6c9a80d + title: ServiceUnavailable + condition: C + data: + - refId: A + relativeTimeRange: + from: 600 + to: 0 + datasourceUid: prometheus + model: + editorMode: code + expr: probe_success{job="https"} + instant: true + intervalMs: 1000 + legendFormat: __auto + maxDataPoints: 43200 + range: false + refId: A + - refId: C + queryType: expression + datasourceUid: __expr__ + model: + conditions: + - evaluator: + params: + - 0 + type: gt + operator: + type: and + query: + params: + - C + reducer: + params: [] + type: last + type: query + datasource: + type: __expr__ + uid: __expr__ + expression: A + intervalMs: 1000 + maxDataPoints: 43200 + refId: C + type: threshold + noDataState: Alerting + execErrState: Alerting + for: 1m + annotations: + runbook_url: https://git.ssw590-08.me/SSW-590-08/Scrap-Web/src/branch/main/monitoring/RUNBOOK.md + summary: https://git.ssw590-08.me/SSW-590-08/Scrap-Web/src/branch/main/monitoring/RUNBOOK.md + labels: + owner: samahk13 + severity: critical + team: ssw590 + isPaused: false + notification_settings: + receiver: team-alerts