Address chapter audit: collection-health alert, hardening, citations (refs #19)
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:
2026-10-28 13:52:13 -04:00
co-authored by Claude Opus 5.5
parent 336eaaefa7
commit 249488d6fc
13 changed files with 422 additions and 99 deletions
+266 -82
View File
@@ -24,15 +24,20 @@ Vincent is the verifier and pull-request reviewer. Times are UTC unless marked
Eastern (EDT, UTC$-$4). Sections~\ref{Section:SREDeployment}--\ref{Section:SREQuality}
follow the eight rubric rows in order. Raw timestamps for every test are kept
in
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/b6cf08061815acd628bf3caaa90e38c46d57a8e7/monitoring/EVIDENCE.md}{\texttt{monitoring/EVIDENCE.md}}.
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/main/monitoring/EVIDENCE.md}{\texttt{monitoring/EVIDENCE.md}};
repository links in this chapter point to \texttt{main}, where
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/pulls/22}{PR~\#22}
merges this work.
\begin{devopsNote}[Result summary]
The stack fits on the existing 1\,GiB droplet without a resize, with memory
caps and a second swap file. Both HTTPS probes, both alert rules, and the
Discord route were tested for real: a disk-space rule fired and resolved
under a temporarily raised threshold, and a planned 4~min~48~s Jenkins stop
fired the availability alert about 2~minutes after injection and resolved
about 1.5~minutes after the restart. Gitea stayed available throughout. The
caps and a second swap file. Both HTTPS probes, all three alert rules, and
the Discord route were tested for real: a disk-space rule fired and resolved
under a temporarily raised threshold; a planned 4~min~48~s Jenkins stop fired
the availability alert about 2~minutes after injection and resolved about
1.5~minutes after the restart; and stopping Blackbox Exporter fired the
collection-health rule and the availability rule's no-data handling. Gitea
stayed available throughout. The
main measured weakness is memory pressure: about 15\% of CPU time is spent
waiting on swap (improvement
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/issues/21}{issue~\#21}).
@@ -44,9 +49,10 @@ waiting on swap (improvement
\index{monitoring!deployment}
\paragraph{Baseline and capacity decision.}
At 04:34 on October 28 the droplet ran Ubuntu 24.04.5 LTS on 1 vCPU with
961\,MiB RAM; 147--229\,MiB was available and 414\,MiB of the 1\,GiB swap
file was already in use. Jenkins used 325\,MiB, Gitea 98\,MiB, and Caddy
At 04:34 on October 28 the droplet ran Ubuntu 24.04.5 LTS (kernel
6.8.0-147, Docker Engine 29.8.1, Compose v5.5.1) on 1 vCPU with 961\,MiB RAM;
147--219\,MiB was available in two samples 17\,s apart, and 414\,MiB of the
1\,GiB swap file was already in use. Jenkins used 325\,MiB, Gitea 98\,MiB, and Caddy
11\,MiB; the root disk had 18.8\,GB of 24.9\,GB free. The four new
containers were expected to need 150--240\,MiB, so the team chose a
\emph{capped trial} on the existing plan instead of an immediate resize, with
@@ -63,9 +69,9 @@ occurred. The trial therefore became the deployment. Section~\ref{Section:SREDas
shows its cost: frequent swap-in wait.
\paragraph{Versions and images.}
All four images come from the projects' own repositories and are pinned by
All four images come from the projects' own repositories~\cite{PrometheusDocs,GrafanaDocker,NodeExporter,BlackboxExporter} and are pinned by
tag \emph{and} digest in
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/b6cf08061815acd628bf3caaa90e38c46d57a8e7/monitoring/compose.yaml}{\texttt{monitoring/compose.yaml}}
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/main/monitoring/compose.yaml}{\texttt{monitoring/compose.yaml}}
(Table~\ref{Table:SREImages}). The instructor suggests a \texttt{.env} file
for the tags; this repository ignores every \texttt{.env} file to keep
secrets out of Git, so the versions live in the Compose file instead and are
@@ -87,7 +93,7 @@ Blackbox Exporter & \nolinkurl{quay.io/prometheus/blackbox-exporter:v0.29.1} & \
\end{table}
\paragraph{Retention and storage.}
Prometheus keeps 7 days or 500\,MB, whichever limit is reached first
Prometheus keeps 7 days or 500\,MB, whichever limit is reached first~\cite{PrometheusDocs}
(\texttt{--storage.tsdb.retention.time=7d},
\texttt{--storage.tsdb.retention.size=500MB}), and its Go runtime aims to
stay under 96\,MiB (\texttt{GOMEMLIMIT}). With about 15\,GB free after the
@@ -95,6 +101,19 @@ image pulls (Grafana's image alone is 1.95\,GB), this leaves room for the
operating system, Gitea, and builds. Node Exporter runs only the CPU, memory,
filesystem, load, and uname collectors.
\paragraph{Identities and mounts.}
Prometheus and Node Exporter run as \texttt{nobody} (UID 65534) and Grafana
as UID 472, the images' defaults. Blackbox Exporter's image runs as root;
because HTTP probes need no privileges, it was changed to
\texttt{user: "65534:65534"} on October 28 at 17:33 and probes kept working.
Prometheus stores its database at \texttt{/prometheus} (volume
\nolinkurl{monitoring_prometheus_data}) and Grafana its database and plugins
at \texttt{/var/lib/grafana} (volume \nolinkurl{monitoring_grafana_data}).
Configuration is bind-mounted read-only:
\texttt{/etc/prometheus/prometheus.yml}, \texttt{/config/blackbox.yml},
\texttt{/etc/grafana/provisioning}, and \texttt{/var/lib/grafana-dashboards};
Node Exporter reads the host at \texttt{/host} (read-only).
\paragraph{Deployment diagram.}
Figure~\ref{Figure:SREDeployment} shows what was built. Prometheus and both
exporters sit only on the private \texttt{monitoring} network. Grafana also
@@ -115,15 +134,16 @@ address 172.30.90.10 and Caddy answers as \texttt{git.yebilly.me} and
arr/.style={-{Stealth}, thick}]
\node[box] (browser) at (-0.6,0) {\guillemotleft device\guillemotright\\Team / grader\\browser};
\node[box] (fw) at (3.4,0) {\guillemotleft device\guillemotright\\Cloud Firewall\\\texttt{gitea-fw}, 443 / 80};
\node[box] (caddy) at (7.9,0) {\guillemotleft container\guillemotright\\Caddy TLS proxy\\allowlist: \texttt{ci}, \texttt{metrics}};
\node[box] (gitea) at (13.4,2.4) {\guillemotleft container\guillemotright\\Gitea \texttt{:3000}};
\node[box] (jenkins) at (13.4,0.6) {\guillemotleft container\guillemotright\\Jenkins \texttt{:8080}};
\node[new] (grafana) at (13.4,-1.7) {\guillemotleft container\guillemotright\\Grafana OSS \texttt{:3000}\\dashboard, alert rules};
\node[new] (prom) at (13.4,-4.7) {\guillemotleft container\guillemotright\\Prometheus \texttt{:9090}\\scrapes every 30\,s};
\node[new] (bbox) at (7.9,-4.7) {\guillemotleft container\guillemotright\\Blackbox Exporter\\\texttt{:9115}, 172.30.90.10};
\node[new] (node) at (17.8,-4.7) {\guillemotleft container\guillemotright\\Node Exporter\\\texttt{:9100}, host \texttt{/} (ro)};
\node[box] (caddy) at (7.9,0) {\guillemotleft container\guillemotright\\Caddy TLS proxy\\allowlist: \texttt{ci}, \texttt{metrics}\\{\scriptsize net: \textit{web, probe}}};
\node[box] (gitea) at (13.4,2.4) {\guillemotleft container\guillemotright\\Gitea \texttt{:3000}\\{\scriptsize net: \textit{web}}};
\node[box] (jenkins) at (13.4,0.6) {\guillemotleft container\guillemotright\\Jenkins \texttt{:8080}\\{\scriptsize net: \textit{web}}};
\node[new] (grafana) at (13.4,-1.7) {\guillemotleft container\guillemotright\\Grafana OSS \texttt{:3000}\\dashboard, alert rules\\{\scriptsize net: \textit{web, mon}}};
\node[new] (prom) at (13.4,-4.7) {\guillemotleft container\guillemotright\\Prometheus \texttt{:9090}\\scrapes every 30\,s\\{\scriptsize net: \textit{mon}}};
\node[new] (bbox) at (7.9,-4.7) {\guillemotleft container\guillemotright\\Blackbox Exporter\\\texttt{:9115}, 172.30.90.10\\{\scriptsize net: \textit{mon, probe}}};
\node[new] (node) at (17.8,-4.7) {\guillemotleft container\guillemotright\\Node Exporter\\\texttt{:9100}, host \texttt{/} (ro)\\{\scriptsize net: \textit{mon}}};
\node[box] (pvol) at (13.4,-7.2) {\guillemotleft artifact\guillemotright\\\texttt{prometheus\_data}\\7\,d / 500\,MB};
\node[box] (gvol) at (17.8,-1.7) {\guillemotleft artifact\guillemotright\\\texttt{grafana\_data}\\users, alert state};
\node[box] (evol) at (17.8,1.5) {\guillemotleft artifact\guillemotright\\\texttt{gitea-data}, \texttt{jenkins-home},\\\texttt{caddy-data}, \texttt{caddy-config}};
\node[box] (discord) at (3.4,-7.2) {\guillemotleft device\guillemotright\\Discord\\\texttt{\#devops-alerts}};
\draw[arr] (browser) -- node[lbl, above=3pt]{HTTPS} (fw);
\draw[arr] (fw) -- (caddy);
@@ -136,32 +156,37 @@ address 172.30.90.10 and Caddy answers as \texttt{git.yebilly.me} and
\draw[arr, dashed, devopsGreen] (bbox.north) -- node[lbl, pos=0.78, left=2pt, align=right]{HTTPS probes\\(\texttt{gitea\_probe})} (caddy.south);
\draw[arr] (prom) -- (pvol);
\draw[arr] (grafana) -- (gvol);
\draw[arr] (gitea.east) -| ([xshift=-6mm]evol.north);
\draw[arr] (jenkins.east) -- (jenkins.east -| evol.west);
\draw[arr, dashed, devopsRed] (grafana.230) -- ++(0,-0.95) -| node[lbl, pos=0.8, left=2pt]{alerts (HTTPS out)} (discord.north);
\node[draw, dashed, rounded corners, fit=(caddy) (gitea) (jenkins) (grafana) (prom) (bbox) (node) (pvol) (gvol), inner sep=10pt,
\node[draw, dashed, rounded corners, fit=(caddy) (gitea) (jenkins) (grafana) (prom) (bbox) (node) (pvol) (gvol) (evol), inner sep=10pt,
label={[font=\scriptsize]above:\guillemotleft device\guillemotright\ Droplet \texttt{The-Ocean} (1\,GiB RAM, 2\,GiB swap) / \guillemotleft executionEnvironment\guillemotright\ Docker networks \texttt{gitea\_web}, \texttt{gitea\_probe}, \texttt{monitoring}}] {};
\end{tikzpicture}}
\caption{UML deployment diagram after Assignment 7. Shaded boxes are the four
new containers; arrows point from the side that opens the connection. Only
Caddy's 80/443 are public. Blackbox Exporter probes the real HTTPS hostnames
through Caddy on the private probe network; Grafana sends alert notifications
outward to Discord. Gitea's and Jenkins' volumes are as in
\ChapterRef{JenkinsCI}.}
outward to Discord. Network tags: \textit{web} = \texttt{gitea\_web},
\textit{probe} = \texttt{gitea\_probe}, \textit{mon} =
\texttt{monitoring\_monitoring}. Artifacts are named Docker volumes (Compose
prefixes \texttt{gitea\_} and \texttt{monitoring\_} omitted); Caddy's volumes
hold its certificates and configuration.}
\label{Figure:SREDeployment}
\end{figure}
\paragraph{Configuration in Git and secrets outside it.}
The
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/b6cf08061815acd628bf3caaa90e38c46d57a8e7/monitoring}{\texttt{monitoring/}}
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/main/monitoring}{\texttt{monitoring/}}
folder holds the Compose file, \texttt{prometheus/prometheus.yml},
\texttt{blackbox/blackbox.yml}, Grafana provisioning (data source, dashboard
loader, both alert rules, the contact point), the dashboard JSON, and a
loader, three alert rules, the contact point), the dashboard JSON, and a
\texttt{README.md} with deploy, update, backup, rollback, and runbook steps.
Provisioned items are read-only in Grafana's interface, so Git is their source
of truth. Two secrets live only in \texttt{\textasciitilde/monitoring/.env.secret}
on the droplet (mode 600, root): the initial Grafana administrator password
and the Discord webhook URL. Billy typed both in his own SSH session; the
contact point reads the URL through \texttt{\$DISCORD\_WEBHOOK\_URL}, so
it appears in no file in Git. Monitoring containers get no Docker socket and
of truth. Secrets live only in \texttt{\textasciitilde/monitoring/.env.secret}
on the droplet (mode 600, root), typed by Billy in his own SSH session: the
Discord webhook URL, and until it was replaced (Section~\ref{Section:SREAccess})
the initial Grafana administrator password. The contact point reads the URL
through \texttt{\$DISCORD\_WEBHOOK\_URL}, so it appears in no file in Git. Monitoring containers get no Docker socket and
no \texttt{privileged} flag. Node Exporter needs the host's process ID
namespace and a read-only bind of \texttt{/} to report host CPU, memory, and
disk; that mount lets the container read host files, which is accepted for
@@ -182,22 +207,32 @@ docker compose up -d && docker compose ps
\end{minted}
The \texttt{chmod} line was added after Grafana first logged
\texttt{permission denied}: \texttt{scp} from Windows creates root-only
directories, and Grafana runs as user 472. Start-up order does not matter,
and every service uses \texttt{restart: unless-stopped}. Routine pauses use
directories, and Grafana runs as user 472. The Gitea stack in
\texttt{\textasciitilde/gitea} must be up first, because it creates the
external networks \texttt{gitea\_web} and \texttt{gitea\_probe}; inside the
monitoring stack the start-up order does not matter, and every service uses
\texttt{restart: unless-stopped}. Routine pauses use
\texttt{docker compose stop}/\texttt{start}; \texttt{docker compose down -v}
must never be used because it deletes both named volumes. An upgrade changes
one image's tag and digest at a time after a backup, and is rolled back by
restoring the backup rather than assuming an older release can read newer
data. Grafana and Prometheus state that Git cannot rebuild (users, alert
state, metric history) is backed up with the \texttt{tar} procedure in the
README; no scheduled backup exists yet.
state, metric history) is backed up as follows; no scheduled backup exists
yet:
\begin{minted}[breaklines]{sh}
cd ~/monitoring && docker compose stop grafana prometheus
docker run --rm -v monitoring_grafana_data:/g:ro -v monitoring_prometheus_data:/p:ro \
-v /root/backups:/b alpine tar czf /b/monitoring-$(date -u +%Y%m%dT%H%M%SZ).tgz /g /p
docker compose start grafana prometheus
\end{minted}
\paragraph{Restart persistence.}
Prometheus was restarted at 16:12:09 and answered at 16:12:15; its oldest
sample (14:52:16) remained, and the raw scrapes at 16:12:06 and 16:12:36
show no missed interval because the restart fell between them. Grafana was
restarted at 16:12:56; at 16:13:44 the dashboard (version~2, 7 panels), the
data source, both rules, the contact point, and the administrator login were
restarted at 16:12:56; at 16:13:44 the dashboard (with the I/O-wait change,
7 panels), the data source, the two rules then defined, the contact point, and
the administrator login were
all present. A restart shows persistence on the named volumes; it is not a
backup restore.
@@ -224,8 +259,44 @@ uses the multi-target pattern: each URL becomes the probe target and the
- {source_labels: [__param_target], target_label: instance}
- {target_label: __address__, replacement: blackbox-exporter:9115}
\end{minted}
At about 14:56 all five targets reported \texttt{up} with no error; scrape
durations were 0.03--0.23\,s.
The target view used for collection health (Prometheus' targets API, which
the \emph{Scrape health} panel also shows) is summarized in
Table~\ref{Table:SRETargets}.
\begin{table}[H]
\centering\footnotesize
\caption{Scrape targets, October 28, 2026 (UTC)\label{Table:SRETargets}}
\begin{tabular}{@{}llllr@{}}
\toprule \textbf{Job} & \textbf{Target (instance)} & \textbf{Health} & \textbf{Last error} & \textbf{Scrape time}\\ \midrule
\texttt{prometheus} & \texttt{prometheus:9090} & up & none & 0.022\,s\\
\texttt{node} & \texttt{node-exporter:9100} & up & none & 0.062\,s\\
\texttt{blackbox} & \texttt{blackbox-exporter:9115} & up & none & 0.004\,s\\
\texttt{https} & \texttt{https://git.yebilly.me/user/login} & up & none & 0.128\,s\\
\texttt{https} & \texttt{https://ci.yebilly.me/login} & up & none & 0.064\,s\\
\bottomrule
\end{tabular}
\end{table}
\noindent All five were also up with no error at about 14:56, shortly after
start-up (scrape times 0.031--0.226\,s); the table shows the check at 17:31.
\paragraph{Probe module.}
\texttt{blackbox/blackbox.yml} defines the module the \texttt{https} job uses~\cite{BlackboxExporter}:
\begin{minted}[breaklines]{yaml}
modules:
http_2xx:
prober: http
timeout: 10s
http:
method: GET
preferred_ip_protocol: ip4
valid_status_codes: [] # empty = any 2xx
follow_redirects: true
fail_if_not_ssl: true
tls_config:
insecure_skip_verify: false
\end{minted}
The probes use IPv4: the private probe network has no IPv6, and public DNS
publishes only \texttt{A} records.
\paragraph{Probe success criteria.}
The \texttt{http\_2xx} module defines success as: a DNS answer, a TLS
@@ -252,7 +323,7 @@ hair-pinned visitors with a network gateway address (first 172.18.0.1, now
confirms it is.
\paragraph{Host metric verification.}
At 14:56:37 Node Exporter's root filesystem series carried the labels
At 14:56:37 Node Exporter's~\cite{NodeExporter} root filesystem series carried the labels
\texttt{device="/dev/vda1"}, \texttt{fstype="ext4"}, and
\texttt{mountpoint="/"}; the container's overlay filesystems are excluded by
Node Exporter's defaults. The dashboard and the disk alert select exactly
@@ -260,7 +331,13 @@ Node Exporter's defaults. The dashboard and the disk alert select exactly
24{,}883{,}167{,}232\,bytes, equals \texttt{df -B1 /}; available bytes differed
by 4\,KB from \texttt{df}, read seconds apart. \texttt{MemTotal}
(1{,}008{,}177{,}152\,bytes) equals \texttt{free -b}; \texttt{MemAvailable}
was 293.4 against 301.0\,MB a few seconds apart.
was 293.4 against 301.0\,MB a few seconds apart. CPU counters were compared
with \texttt{/proc/stat} (divided by \texttt{USER\_HZ} = 100) at 17:30:59:
user 4{,}099.5 against 4{,}100.8\,s, system 1{,}768.0 against 1{,}768.9\,s,
idle 562{,}034 against 562{,}053\,s, I/O wait 2{,}078.2 against 2{,}080.2\,s,
steal 1{,}726.4 against 1{,}727.5\,s. Each exported counter trails the kernel
by about the age of the last scrape (up to 30\,s), so the panels derive CPU
use from rates rather than raw totals.
\begin{table}[htbp]
\centering\footnotesize
@@ -291,10 +368,26 @@ Jenkins: \url{https://ci.yebilly.me/login};
Grafana: \url{https://metrics.yebilly.me/login}.
Gitea is public. Jenkins and Grafana answer only the Stevens network
155.246.0.0/16 and approved team or grader addresses, then require their own
login. Grafana has no anonymous access and no self sign-up. Accounts:
\texttt{billy} (Admin) and \texttt{vsun1} (Vincent, Viewer, added at 17:03;
least privilege, because changes go through Git). Graders do not need an account: the dashboard and
alert evidence is in this chapter.
login. Grafana has no anonymous access and no self sign-up
(\texttt{GF\_AUTH\_ANONYMOUS\_ENABLED=false}, \texttt{GF\_USERS\_ALLOW\_SIGN\_UP=false}),
its session cookie is marked secure, and its external root URL is set to
\texttt{https://metrics.yebilly.me/} (\texttt{GF\_SERVER\_ROOT\_URL}) so
alert links and redirects use the HTTPS hostname. Accounts: \texttt{billy}
(Admin) and \texttt{vsun1} (Vincent, Viewer, added at 17:03; least privilege,
because changes go through Git). Graders do not need an account: the
dashboard and alert evidence is in this chapter.
\paragraph{Initial credential.}
Grafana's built-in \texttt{admin}/\texttt{admin} was never active: the first
administrator, \texttt{billy}, was created at first start with a password
Billy typed into the root-only secrets file. That first password was then
replaced in Grafana (\emph{Profile} $\rightarrow$ \emph{Change password}) on
October 28; at 17:29:34 the old value was rejected (HTTP 401), its line was
deleted from \texttt{.env.secret}, and recreating Grafana at 17:33 removed it
from the container's environment. The current password exists only in
Billy's password manager and Grafana's database. The change came several
hours after first login rather than immediately, because the gap was found
in a review of this chapter.
\paragraph{DNS and certificate.}
Billy added the \texttt{A} record \texttt{metrics} $\rightarrow$
@@ -336,7 +429,18 @@ Caddyfile were copied to \texttt{\textasciitilde/gitea/backup-20261028T144040Z}.
\pagebreak[3]
\paragraph{External exposure tests.}
Billy's laptop (home network on the team allowlist; IPv6 available) ran the
tests in Table~\ref{Table:SREExposure} at 14:57.
tests in Table~\ref{Table:SREExposure} at 14:57 with \texttt{curl}; a status
of \texttt{000} means no TCP connection within the 5\,s limit:
\begin{minted}[breaklines]{sh}
for host in 147.182.178.136 "[2604:a880:400:d1:0:5:22d:6001]"; do
for p in 3000 3001 8080 9090 9100 9115 50000; do
curl -s -o /dev/null -m 6 --connect-timeout 5 -w "%{http_code}" "http://$host:$p/"; echo " $host:$p"
done
done
curl -s -o /dev/null -w "%{http_code}" https://metrics.yebilly.me/api/dashboards/uid/group1-sre
curl -s -6 -o /dev/null --resolve ci.yebilly.me:443:2604:a880:400:d1:0:5:22d:6001 \
-w "%{http_code}" https://ci.yebilly.me/login
\end{minted}
{\small
\begin{tabularx}{\linewidth}{L{5.2cm}L{1.9cm}Y}
@@ -364,7 +468,7 @@ The provisioned dashboard \emph{Group 1 SRE} uses Eastern time
(\texttt{America/New\_York}), a 6-hour default range, 30\,s refresh, and the private data source
\texttt{http://prometheus:9090}. It was written for this deployment, not
imported, and its definition is versioned as
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/commit/b6cf08061815acd628bf3caaa90e38c46d57a8e7/monitoring/grafana/dashboards/sre.json}{\texttt{sre.json}}. Table~\ref{Table:SREPanels} lists the six
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/main/monitoring/grafana/dashboards/sre.json}{\texttt{sre.json}}. Table~\ref{Table:SREPanels} lists the six
required panels and the optional seventh with their queries;
Figure~\ref{Figure:SREDashboard} shows them. In the queries, \texttt{R}
stands for the root-filesystem selector
@@ -471,7 +575,7 @@ lab observation window, evaluated separately for Gitea and Jenkins. An
\gls{sla} is a promise to a customer, usually with consequences if missed;
this project makes no SLA. The \gls{error-budget} is the failure the SLO
still allows, here 1\% of the window's probes. The approach follows the
Google SRE Workbook.\footnote{\url{https://sre.google/workbook/implementing-slos/}}
Google SRE Workbook~\cite{SREWorkbook}.
The 99\% figure is an exercise target, not a reliability promise.
\paragraph{Worked example (hypothetical numbers from the instructor).}
@@ -524,25 +628,35 @@ day's only failures, Jenkins would reach $2{,}869/2{,}880 = 99.62\%$ and use
\index{runbook}
\paragraph{Rules.}
Both rules are Grafana-managed and provisioned from
\texttt{grafana/provisioning/alerting/sre.yaml} (Table~\ref{Table:SRERules}).
They are evaluated every 30\,s, matching the scrape interval. Missing data
counts as \emph{Alerting} rather than healthy, and a query error sets the
\emph{Error} state, which also notifies. A missing probe series or failed
collection therefore reaches the team, but a stopped Grafana cannot alert
anyone (Section~\ref{Section:SREIncident}).
The instructor's two required rules, plus one collection-health rule, are
Grafana-managed and provisioned from
\texttt{grafana/provisioning/alerting/sre.yaml}~\cite{GrafanaAlerting} (Table~\ref{Table:SRERules}).
All are evaluated every 30\,s, matching the scrape interval. For each rule,
a query that returns no data counts as \emph{Alerting} rather than healthy,
and a query error sets the \emph{Error} state, which also notifies. One case
is not covered by that setting alone: \emph{HTTPS service down} queries both
probe series together, so if only one of them disappeared while the other
remained, Grafana would mark the missing one \emph{MissingSeries} and resolve
it. \emph{Monitoring target down} closes that gap: every scrape target,
including each HTTPS probe target, has its own \texttt{up} series, so a
stopped exporter or an unreachable probe is reported per target. A stopped
Grafana still cannot alert anyone (Section~\ref{Section:SREIncident}).
{\small
\begin{tabularx}{\linewidth}{L{2.6cm}YY}
\begin{tabularx}{\linewidth}{L{2.0cm}YYY}
\caption{Alert rules\label{Table:SRERules}}\\
\toprule & \textbf{HTTPS service down} & \textbf{Root disk space low}\\ \midrule
Owner / severity & Billy (backup Vincent) / critical & Billy (backup Vincent) / warning\\
Query & \texttt{probe\_success} of the \texttt{https} job, one instance per service & Panel~3's query (percent available on the root filesystem)\\
Condition / pending & below 1 for 1\,minute & below 15 for 5\,minutes\\
No data / error & Alerting / Error & Alerting / Error\\
Notification & \texttt{team-alerts}; group by alert and instance & \texttt{team-alerts}; group by alert\\
Timing & group wait 10\,s, group interval 1\,m, repeat 4\,h & same\\
Runbook & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/main/monitoring/README.md\#runbook-https-service-down}{README: HTTPS service down} & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/main/monitoring/README.md\#runbook-root-disk-space-low}{README: Root disk space low}\\
\toprule & \textbf{HTTPS service down} & \textbf{Root disk space low} & \textbf{Monitoring target down}\\ \midrule
\endfirsthead
\toprule & \textbf{HTTPS service down} & \textbf{Root disk space low} & \textbf{Monitoring target down}\\ \midrule
\endhead
Summary & ``\textit{instance} HTTPS probe is failing'' & ``Root filesystem on The-Ocean below 15\% free'' & ``\textit{job} target \textit{instance} is not being collected''\\
Owner / severity & Billy (backup Vincent) / critical & Billy (backup Vincent) / warning & Billy (backup Vincent) / critical\\
Query & \texttt{probe\_success} of the \texttt{https} job, one instance per service & Panel~3's query (percent available on the root filesystem) & \texttt{up}, one series per scrape target\\
Condition / pending & below 1 for 1\,minute & below 15 for 5\,minutes & below 1 for 1\,minute\\
No data / error & Alerting / Error & Alerting / Error & Alerting / Error\\
Notification & \texttt{team-alerts}; group by alert and instance & \texttt{team-alerts}; group by alert & \texttt{team-alerts}; group by alert\\
Timing & group wait 10\,s, group interval 1\,m, repeat 4\,h & same & same\\
Runbook & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/main/monitoring/README.md\#runbook-https-service-down}{README} & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/main/monitoring/README.md\#runbook-root-disk-space-low}{README} & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/main/monitoring/README.md\#runbook-monitoring-target-down}{README}\\
\bottomrule
\end{tabularx}}
@@ -550,8 +664,32 @@ The worst-case time from an outage to a notification is about one scrape
(30\,s) plus one evaluation (30\,s) plus the pending period (60\,s) plus the
group wait (10\,s): 2~minutes 10~seconds. The 15\% disk threshold is about
3.7\,GB of the 24.9\,GB disk: enough time to clear build cache, journals, or
old images before Gitea, Jenkins, or Prometheus fail to write. The runbooks
say who acts and what to try first, and never to use \texttt{down -v}.
old images before Gitea, Jenkins, or Prometheus fail to write.
\paragraph{Runbooks.}
The owner (Billy; Vincent as backup) first acknowledges in
\texttt{\#devops-alerts} with name and time, then:
\begin{itemize}[nosep]
\item \emph{HTTPS service down.} Check on the dashboard whether one or both
services are down and whether scrape health is also failing (then the cause is
collection, not the service). On the droplet: \texttt{cd \textasciitilde/gitea
\&\& docker compose ps} and \texttt{docker compose logs -{}-tail=50
<service>}. A stopped container: \texttt{docker compose start <service>}; a
running but failing one: \texttt{docker compose restart <service>}. Confirm the
probe returns to 1, the resolved message arrives, and, for Jenkins, that a
pipeline run passes.
\item \emph{Root disk space low.} Run \texttt{df -h /} and \texttt{docker system df};
clear build cache (\texttt{docker builder prune}), journals
(\texttt{journalctl -{}-vacuum-size=200M}), and unused images. Never delete
volumes; if Prometheus is the cause, lower its size limit. Plan a disk resize
with the team if space cannot be recovered.
\item \emph{Monitoring target down.} The \texttt{job} label names the
collector (\texttt{blackbox}/\texttt{https}: Blackbox Exporter; \texttt{node};
\texttt{prometheus}). In \texttt{\textasciitilde/monitoring}: \texttt{docker
compose ps} and logs, then \texttt{start} or \texttt{restart} the service.
Until it resolves, treat the dashboard and the other alerts as partly blind.
\end{itemize}
No runbook step uses \texttt{docker compose down -v}.
\paragraph{Contact point.}
The \gls{contact-point} \texttt{team-alerts} uses Grafana's Discord integration
@@ -562,7 +700,8 @@ was sent at 15:05:55 through the replacement endpoint, which uses the stored
URL without exposing it (command in the README). Grafana returned
\texttt{status success} and the test message reached \texttt{\#devops-alerts}
(Figure~\ref{Figure:SREContactTest}). This proves delivery only. The rules
and routing were proven by the two tests below.
and routing were proven by the capacity and collection tests below and by
the Jenkins outage in Section~\ref{Section:SREIncident}.
\begin{figure}[H]
\centering
@@ -603,8 +742,33 @@ after the 15\% threshold was restored (right).}
\label{Figure:SREDiskAlert}
\end{figure}
The availability rule was tested by the controlled incident in the next
section.
\paragraph{Collection-health test.}
At 17:34:44 Blackbox Exporter was stopped (\texttt{docker compose stop
blackbox-exporter}). The first failed scrape followed at 17:34:56; by 17:35:07
the \texttt{blackbox} target and both \texttt{https} targets read
\texttt{up = 0}, and no \texttt{probe\_success} series existed at all. At
1:36~p.m.\ Eastern Discord received \emph{Monitoring target down} for
\texttt{blackbox-exporter:9115} and, in the same minute, \emph{HTTPS service
down} for both login URLs with \texttt{grafana\_state\_reason = NoData}: with
every probe series gone, the availability rule's no-data policy fired as
designed. At 1:37~p.m.\ the collection alert was updated to all three
targets (\texttt{[FIRING:3]}). Blackbox Exporter was started again at
17:37:52, all five targets were up at 17:38:25, and Discord received
\emph{Resolved} for both rules by 1:39~p.m.\ (Figure~\ref{Figure:SRECollection}).
\begin{figure}[H]
\centering
\includegraphics[width=0.49\linewidth]{images/discord-collection-firing-2026-10-28.png}\hfill
\includegraphics[width=0.49\linewidth]{images/discord-collection-resolved-2026-10-28.png}
\caption{October 28, 2026, 1:36--1:39 p.m.\ Eastern: collection test. Left:
\emph{Monitoring target down} for Blackbox Exporter and \emph{HTTPS service
down} fired by missing data (\texttt{NoData}). Right: \emph{Monitoring target
down} resolved for all three affected targets.}
\label{Figure:SRECollection}
\end{figure}
The availability rule's real-outage test was the controlled incident in the
next section.
%---------------------------------------------------------------
\section{Incident and Recovery}
@@ -619,8 +783,11 @@ command: \texttt{cd \textasciitilde/gitea \&\& docker compose start jenkins}.
Billy, as owner, acknowledged and approved the restart; Claude ran the
commands. Before starting, the team confirmed that no build was running. The
exercise would be ended early if anything else failed or it ran past about
8 minutes.
8 minutes. It ran 4~minutes 48~seconds, longer than the planned three,
because the restart waited for the owner's acknowledgement of the alert; that
stayed inside the 8-minute limit, and no other service was affected.
\clearpage
\paragraph{Timeline.}
Table~\ref{Table:SREIncident} combines Prometheus sample times, Grafana rule
states polled every 6\,s, the Jenkins log, and Discord timestamps, all in UTC.
@@ -680,10 +847,19 @@ At 16:11:46 the Jenkins and Gitea login pages returned 200 from Billy's
laptop. Billy then pushed \texttt{b6cf080}. Gitea's webhook started Jenkins
build~\#2 (pending status 16:36:27), and the build passed at 16:37:08 after
33.9\,s with both tests passing. This proves the webhook, the pipeline, and
the status report back to Gitea after the outage. The manual-PDF workflow
runs only on pushes to \texttt{main}, on Vincent's laptop runner, so it is
checked when this branch is merged; the PDF's title-page build suffix
identifies that run.
the status report back to Gitea after the outage. The changes then went
through the established review gate as
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/pulls/22}{PR~\#22}
(\texttt{feature/issue-19-monitoring} into \texttt{main}): the required
check \texttt{vpn-dns-gateway/pipeline/pr-main} passed (on the manual commit
at 17:12:32), and Vincent approved at 17:09; Gitea dismisses an approval
as stale when later commits arrive, so branch protection requires a fresh
approval of the final head before the merge can happen. The manual-PDF workflow runs only on pushes to \texttt{main}, on
Vincent's laptop runner, so its post-outage run is the merge build that
produced this PDF; the title-page build suffix
(\texttt{+build.}\textit{run}\texttt{.}\textit{commit}) identifies that run
and the merge commit, listed under
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/actions}{Gitea Actions}.
\paragraph{How this differs from a failed build.}
In \ChapterRef{JenkinsCI}, PR~\#15's deliberate unit-test failure
@@ -707,7 +883,7 @@ link and the failing URL. \emph{Measurement gaps:} the acknowledgement was
given to the operator rather than posted in Discord before the restart, so
its exact time is not timestamped in the channel; the next exercise should
acknowledge in the channel first. Probe timing is limited to 30\,s samples.
The 1.5-minute Jenkins start-up and the swap pressure in
The minute-long Jenkins start-up and the swap pressure in
Section~\ref{Section:SREDashboard} share one cause: too little memory.
\emph{Shared failure domain:} monitoring runs on the same droplet, so a
whole-droplet outage would silence collection and alerts together, and the
@@ -735,9 +911,16 @@ deployment; replaced by \texttt{.Labels}. (3) The provisioned contact point
had no \emph{Test} button and the old endpoint was removed, so the new
endpoint was found and documented. (4) One SLO query was first evaluated at
the wrong time (16:23) and was rerun at 16:13. (5) The dashboard's CPU line
was ambiguous under swap pressure, so an I/O-wait line was added. One failed
Grafana administrator login, from a password read with untrimmed whitespace,
occurred at about 15:04 while finding the API route.
was ambiguous under swap pressure, so an I/O-wait line was added. An
independent review of the chapter draft then found: (6) a claim that a missing
probe series always alerts, which was untested and not true for a single
series, so the collection-health rule was added and tested; (7) the initial
Grafana administrator password had not been replaced, so it was; (8) Blackbox
Exporter ran as root, so it now runs as \texttt{nobody}; and smaller gaps in
the diagram, host checks, runbooks, citations, and four wrong figures, all
corrected in this version. One failed Grafana administrator login, from a
password read with untrimmed whitespace, occurred at about 15:04 while finding
the API route.
\paragraph{Cost, ownership, and cleanup.}
No paid service was added. The droplet stays on its 1\,GiB Basic plan (listed
@@ -755,11 +938,12 @@ and the Discord webhook. The four disabled host services can be restored with
\paragraph{Document controls.}
This chapter was added in version 5.0. Document History records it with the
updated title and abstract; \ChapterRef{HostsPasswords} adds the monitoring
host details, \texttt{metrics.yebilly.me}, the Grafana administrator, and the
Discord webhook; new glossary terms are indexed; and AI assistance is recorded
in \ChapterRef{AIPromptLog}. The reviewed configuration is commit
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/commit/b6cf08061815acd628bf3caaa90e38c46d57a8e7}{\texttt{b6cf080}}
on \texttt{feature/issue-19-monitoring}; the merge commit and the Gitea Actions
run that built this PDF are identified by the build suffix on the title page.
host details, \texttt{metrics.yebilly.me}, the Grafana accounts, and the
Discord webhook; new glossary terms are indexed; sources are cited in the
Bibliography; and AI assistance is recorded in \ChapterRef{AIPromptLog}. The
reviewed source is the head of
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/pulls/22}{PR~\#22},
merged into \texttt{main}; the merge commit and the Gitea Actions run that
built this PDF are identified by the build suffix on the title page.
\endgroup