Address chapter audit: collection-health alert, hardening, citations (refs #19)
vpn-dns-gateway/pipeline/pr-main This commit looks good
vpn-dns-gateway/pipeline/pr-main This commit looks good
An independent review of the SRE chapter against the instructor's rubric found gaps; each was fixed and, where operational, tested on the droplet. Monitoring: - New Grafana rule "Monitoring target down" (up < 1 for 1 m, no data -> Alerting). Tested by stopping Blackbox Exporter 17:34:44-17:37:52 UTC: it fired and resolved, and "HTTPS service down" fired on NoData when every probe series disappeared. - Blackbox Exporter runs as nobody (65534) instead of the image's root. - README: runbook for the new rule; contact-point test prompts for the password; secrets section reflects the replaced admin password. Manual (v5.0): - Alert table with all three rules and their summaries; runbooks in the PDF; accurate no-data description; collection-test figure. - Diagram shows networks per container and the existing volumes. - Targets table, CPU counters vs /proc/stat, probe module excerpt, container identities and mounts, backup command, exposure commands, replaced Grafana admin credential, PR #22 and review gate. - Bibliography enabled with SRE Workbook and tool documentation. - Corrected baseline memory figures, Jenkins start-up length, dashboard version wording, and start-up order; links point to main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -141,3 +141,31 @@ undo: systemctl unmask multipathd fwupd udisks2 ModemManager && systemctl enable
|
||||
## Grafana accounts
|
||||
|
||||
- 2026-10-28 17:03:14 UTC Billy created Grafana user vsun1 (Vincent Sun), org role Viewer, not server admin. Org users: billy Admin, vsun1 Viewer.
|
||||
|
||||
## Grafana administrator password replaced
|
||||
|
||||
- ~17:2x UTC Billy changed the billy password in Grafana (Profile -> Change password); the new value is only in his password manager and Grafana's database.
|
||||
- 17:29:34 UTC the previous value (still in the running container's environment) returned HTTP 401 on /api/user: the initial credential is no longer valid.
|
||||
- GF_SECURITY_ADMIN_PASSWORD line removed from ~/monitoring/.env.secret (now only DISCORD_WEBHOOK_URL; mode 600 root); `docker compose config --quiet` valid. The stale value leaves the container environment at the next Grafana recreate.
|
||||
|
||||
## Audit follow-up checks 2026-10-28 (UTC)
|
||||
|
||||
- Baseline detail (first sample 04:34:10): free -b available 154066944 B (146.9 MiB), swap used 434180096 B (414.1 MiB); second sample 04:34:27 available 229351424 B (218.7 MiB). Docker 29.8.1, Compose v5.5.1, kernel 6.8.0-147-generic.
|
||||
- 14:56 target check: all five targets up, lastError none, lastScrapeDuration 0.031-0.226 s.
|
||||
- 17:30:59 CPU counters, /proc/stat (USER_HZ 100) vs node_cpu_seconds_total: user 4100.8 / 4099.5 s, system 1768.9 / 1768.0, idle 562052.6 / 562034.4, iowait 2080.2 / 2078.2, steal 1727.5 / 1726.4 (difference consistent with the <=30 s scrape age).
|
||||
- 17:3x targets: blackbox 0.004 s, https git 0.128 s, https ci 0.064 s, node 0.062 s, prometheus 0.022 s; all up, no error.
|
||||
- Container identities and mounts: prometheus uid 65534 (nobody), /prometheus = volume monitoring_prometheus_data, /etc/prometheus/prometheus.yml bind ro; grafana uid 472, /var/lib/grafana = volume monitoring_grafana_data, /etc/grafana/provisioning and /var/lib/grafana-dashboards bind ro; node-exporter uid 65534, /host bind ro; blackbox-exporter uid 0 (image default), /config/blackbox.yml bind ro -> changed to user 65534:65534 (see below).
|
||||
|
||||
## Collection-health rule and non-root Blackbox (UTC)
|
||||
|
||||
- Local smoke run: new rule "Monitoring target down" (expr `up`, < 1 for 1 m, no data -> Alerting, error -> Error) loaded healthy and went Pending for the absent node target; blackbox-exporter as uid 65534 probed successfully.
|
||||
- 17:33:23 deployed sre.yaml (third rule), compose.yaml (blackbox `user: "65534:65534"`), README (runbook, password prompt); `docker compose up -d grafana blackbox-exporter`. 17:33:57 "finished to provision alerting", no errors. blackbox id uid=65534(nobody). Old admin password no longer in the Grafana container environment. 17:34:15 all five targets up.
|
||||
|
||||
## Collection-health test: Blackbox Exporter stopped (UTC; EDT = UTC-4)
|
||||
|
||||
- Pre: up blackbox=1, prometheus=1, https=1 (x2), node=1.
|
||||
- 17:34:44 INJECT `docker compose stop blackbox-exporter`.
|
||||
- 17:34:56 first failed scrape: up blackbox=0, one https target 0; 17:35:07 both https targets 0; count(probe_success) returned no series from 17:35:07 until the restore (probe series absent, not 0).
|
||||
- 17:37:52 RESTORE `docker compose start blackbox-exporter`; 17:38:25 all five targets up; blackbox uid 65534.
|
||||
- Grafana alert state could not be read through the API (admin password now known only to Billy); notifications are evidenced by the Discord screenshots.
|
||||
- Discord #devops-alerts (screenshots), EDT: 1:36 PM "[FIRING:1] Monitoring target down" instance blackbox-exporter:9115 job blackbox, A=0; same minute "[FIRING:1] HTTPS service down" for ci and for git with grafana_state_reason=NoData, A=-1 (probe series absent -> no-data policy Alerting); 1:37 PM "[FIRING:3] Monitoring target down" (blackbox plus both https targets); RESOLVED (A=1) for HTTPS service down git and ci (1:39 PM for ci) and "[RESOLVED] Monitoring target down" for all three at 1:39 PM.
|
||||
|
||||
+23
-4
@@ -26,8 +26,10 @@ GF_SECURITY_ADMIN_PASSWORD=<from the team password manager>
|
||||
DISCORD_WEBHOOK_URL=<webhook for #devops-alerts>
|
||||
```
|
||||
|
||||
The admin password applies only when Grafana first creates its database; later
|
||||
changes are made in Grafana and recorded in the password manager.
|
||||
The admin password applies only when Grafana first creates its database. At
|
||||
first login, change it in Grafana (Profile → Change password), store the new
|
||||
value in the password manager, and delete the `GF_SECURITY_ADMIN_PASSWORD`
|
||||
line from `.env.secret`; on The-Ocean this was done on 28 Oct 2026.
|
||||
|
||||
## Deploy
|
||||
|
||||
@@ -70,7 +72,7 @@ retries scrapes. All four services restart `unless-stopped`.
|
||||
|
||||
```bash
|
||||
GIP=$(docker inspect monitoring-grafana-1 --format '{{(index .NetworkSettings.Networks "monitoring_monitoring").IPAddress}}')
|
||||
P=$(docker exec monitoring-grafana-1 printenv GF_SECURITY_ADMIN_PASSWORD)
|
||||
read -rs -p 'Grafana password for billy: ' P; echo # typed, never stored
|
||||
curl -s -u "billy:$P" -H 'Content-Type: application/json' -X POST \
|
||||
-d '{"integration":{"uid":"team-alerts-discord","type":"discord","version":"v1","settings":{},"secureFields":{"url":true}}}' \
|
||||
"http://$GIP:3000/apis/notifications.alerting.grafana.app/v1beta1/namespaces/default/receivers/dGVhbS1hbGVydHM/test"
|
||||
@@ -91,10 +93,27 @@ retries scrapes. All four services restart `unless-stopped`.
|
||||
(volumes kept), then revert the `metrics` block and probe allowlist entry in
|
||||
`deploy/Caddyfile` and recreate Caddy.
|
||||
|
||||
## Runbook: Monitoring target down
|
||||
|
||||
Alert `Monitoring target down` (critical, owner Billy, backup Vincent): a
|
||||
Prometheus scrape target (`up`) has failed for 1 minute, or no target data
|
||||
exists. While it fires, the dashboard and the other alerts are partly blind.
|
||||
|
||||
1. Acknowledge in `#devops-alerts` with your name and the time.
|
||||
2. The `job` label names the broken collector: `blackbox` or `https` means
|
||||
Blackbox Exporter, `node` means Node Exporter, `prometheus` means Prometheus.
|
||||
3. On the droplet: `cd ~/monitoring && docker compose ps`, then
|
||||
`docker compose logs --tail=50 <service>`.
|
||||
4. Stopped: `docker compose start <service>`. Running but failing:
|
||||
`docker compose restart <service>`. Never use `down -v`.
|
||||
5. Confirm all targets are up again (dashboard *Scrape health* panel) and that
|
||||
Discord shows the resolved message.
|
||||
|
||||
## Runbook: HTTPS service down
|
||||
|
||||
Alert `HTTPS service down` (critical, owner Billy, backup Vincent): a login
|
||||
page's `probe_success` has been 0 for 1 minute, or the probe series is missing.
|
||||
page's `probe_success` has been 0 for 1 minute. If the probe series disappears
|
||||
instead, this rule can resolve; `Monitoring target down` reports that case.
|
||||
|
||||
1. Acknowledge in `#devops-alerts` with your name and the time.
|
||||
2. Open the `Group 1 SRE` dashboard. Is only one service down, or both?
|
||||
|
||||
@@ -72,6 +72,7 @@ services:
|
||||
blackbox-exporter:
|
||||
image: quay.io/prometheus/blackbox-exporter:v0.29.1@sha256:ea1c7aa3ef3f307cd03e85f34abb604478ccb90b567fc690da0cd9776da76b13
|
||||
restart: unless-stopped
|
||||
user: "65534:65534" # image default is root; HTTP probes need no privileges
|
||||
command: ["--config.file=/config/blackbox.yml"]
|
||||
volumes:
|
||||
- ./blackbox/blackbox.yml:/config/blackbox.yml:ro
|
||||
|
||||
@@ -86,3 +86,39 @@ groups:
|
||||
group_wait: 10s
|
||||
group_interval: 1m
|
||||
repeat_interval: 4h
|
||||
|
||||
# Collection health: one series per scrape target, so a stopped exporter or a
|
||||
# probe series that disappears is reported instead of silently resolving.
|
||||
- uid: monitoring-target-down
|
||||
title: Monitoring target down
|
||||
condition: C
|
||||
data:
|
||||
- refId: A
|
||||
relativeTimeRange: {from: 300, to: 0}
|
||||
datasourceUid: prometheus
|
||||
model:
|
||||
refId: A
|
||||
expr: up
|
||||
instant: true
|
||||
- refId: C
|
||||
datasourceUid: __expr__
|
||||
model:
|
||||
refId: C
|
||||
type: threshold
|
||||
expression: A
|
||||
conditions:
|
||||
- evaluator: {type: lt, params: [1]}
|
||||
for: 1m
|
||||
noDataState: Alerting # no up series at all: Prometheus has lost every target
|
||||
execErrState: Error # Prometheus itself unreachable
|
||||
labels: {severity: critical, owner: billy}
|
||||
annotations:
|
||||
summary: "{{ .Labels.job }} target {{ .Labels.instance }} is not being collected"
|
||||
description: "Prometheus could not scrape this target for 1 minute; panels and alerts that depend on it are blind. Owner: Billy (backup: Vincent)."
|
||||
runbook_url: https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/main/monitoring/README.md#runbook-monitoring-target-down
|
||||
notification_settings:
|
||||
receiver: team-alerts
|
||||
group_by: [alertname]
|
||||
group_wait: 10s
|
||||
group_interval: 1m
|
||||
repeat_interval: 4h
|
||||
|
||||
Reference in New Issue
Block a user