|
|
|
@@ -0,0 +1,765 @@
|
|
|
|
|
\chapter{Introduction to SRE: Monitoring and Reliability}
|
|
|
|
|
\ChapterLabel{SREMonitoring}
|
|
|
|
|
\index{SRE}
|
|
|
|
|
\index{monitoring}
|
|
|
|
|
\index{Prometheus}
|
|
|
|
|
\index{Grafana}
|
|
|
|
|
\begingroup
|
|
|
|
|
\sloppy
|
|
|
|
|
|
|
|
|
|
This chapter records Assignment 7, \emph{Grafana and Prometheus SRE --
|
|
|
|
|
Group} (instructor manual version 1.42, Chapter 5, \emph{Introduction to SRE:
|
|
|
|
|
Monitoring and Reliability}), the course's introduction to \gls{sre}. Four new
|
|
|
|
|
containers now run beside Gitea, Jenkins, and Caddy on the droplet
|
|
|
|
|
\texttt{The-Ocean}: Prometheus collects time-series metrics, Node Exporter
|
|
|
|
|
reports whole-droplet CPU, memory, and disk, Blackbox Exporter probes the
|
|
|
|
|
Gitea and Jenkins HTTPS login pages, and Grafana OSS shows the dashboard and
|
|
|
|
|
sends alerts to the team's Discord channel. The work was carried out on
|
|
|
|
|
October 28, 2026 under
|
|
|
|
|
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/issues/19}{issue~\#19}
|
|
|
|
|
on branch \texttt{feature/issue-19-monitoring}, starting from \texttt{main}
|
|
|
|
|
at \texttt{9b0dc4d}, whose Jenkins and manual-build checks had passed. Billy
|
|
|
|
|
implemented it with Claude Code running droplet commands that Billy approved;
|
|
|
|
|
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}}.
|
|
|
|
|
|
|
|
|
|
\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
|
|
|
|
|
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}).
|
|
|
|
|
\end{devopsNote}
|
|
|
|
|
|
|
|
|
|
%---------------------------------------------------------------
|
|
|
|
|
\section{Deployment and Reproducibility}
|
|
|
|
|
\label{Section:SREDeployment}
|
|
|
|
|
\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
|
|
|
|
|
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
|
|
|
|
|
written abort limits: stop the stack if available memory stayed below
|
|
|
|
|
50\,MiB, swap use exceeded 1.5\,GiB, the kernel killed a process for lack of
|
|
|
|
|
memory, or a login page took more than about 5\,s. To make room without
|
|
|
|
|
losing a service, four unused Ubuntu services were disabled and masked
|
|
|
|
|
(\texttt{multipathd}, \texttt{fwupd}, \texttt{udisks2},
|
|
|
|
|
\texttt{ModemManager}; the disk is a single virtio device with no multipath
|
|
|
|
|
or boot dependency), and a second 1\,GiB swap file (\texttt{/swapfile2}) was
|
|
|
|
|
added. During the first two minutes after start-up, available memory stayed
|
|
|
|
|
at 156--230\,MiB and swap use reached 707\,MiB; no out-of-memory kill
|
|
|
|
|
occurred. The trial therefore became the deployment. Section~\ref{Section:SREDashboard}
|
|
|
|
|
shows its cost: frequent swap-in wait.
|
|
|
|
|
|
|
|
|
|
\paragraph{Versions and images.}
|
|
|
|
|
All four images come from the projects' own repositories 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}}
|
|
|
|
|
(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
|
|
|
|
|
versioned with it. The pulled \texttt{RepoDigests} matched the pins. Grafana
|
|
|
|
|
13.3.0 had been released the day before and was skipped for the 13.2 line's
|
|
|
|
|
security patch release.
|
|
|
|
|
|
|
|
|
|
\begin{table}[H]
|
|
|
|
|
\centering\footnotesize
|
|
|
|
|
\caption{Monitoring images (amd64), pulled October 28, 2026\label{Table:SREImages}}
|
|
|
|
|
\begin{tabular}{@{}L{2.9cm}L{4.6cm}L{2.6cm}L{4.4cm}@{}}
|
|
|
|
|
\toprule \textbf{Container} & \textbf{Image : tag} & \textbf{Digest} & \textbf{Memory cap / state}\\ \midrule
|
|
|
|
|
Prometheus & \nolinkurl{prom/prometheus:v3.15.1} & \texttt{fa330227\ldots91a2} & 128\,MiB; volume \nolinkurl{monitoring_prometheus_data}\\
|
|
|
|
|
Grafana OSS & \nolinkurl{grafana/grafana:13.2.5} & \texttt{9f7aa1e1\ldots8a84} & 192\,MiB; volume \nolinkurl{monitoring_grafana_data}\\
|
|
|
|
|
Node Exporter & \nolinkurl{quay.io/prometheus/node-exporter:v1.12.1} & \texttt{1b4e4438\ldots1be0} & 32\,MiB; none\\
|
|
|
|
|
Blackbox Exporter & \nolinkurl{quay.io/prometheus/blackbox-exporter:v0.29.1} & \texttt{ea1c7aa3\ldots6b13} & 32\,MiB; none\\
|
|
|
|
|
\bottomrule
|
|
|
|
|
\end{tabular}
|
|
|
|
|
\end{table}
|
|
|
|
|
|
|
|
|
|
\paragraph{Retention and storage.}
|
|
|
|
|
Prometheus keeps 7 days or 500\,MB, whichever limit is reached first
|
|
|
|
|
(\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
|
|
|
|
|
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{Deployment diagram.}
|
|
|
|
|
Figure~\ref{Figure:SREDeployment} shows what was built. Prometheus and both
|
|
|
|
|
exporters sit only on the private \texttt{monitoring} network. Grafana also
|
|
|
|
|
joins Caddy's network \texttt{gitea\_web} so Caddy can reach it; no
|
|
|
|
|
monitoring container publishes a host port, so the Grafana loopback port in
|
|
|
|
|
the instructor's example is not used. Blackbox Exporter joins a small private
|
|
|
|
|
network, \texttt{gitea\_probe} (172.30.90.0/28), where it has the fixed
|
|
|
|
|
address 172.30.90.10 and Caddy answers as \texttt{git.yebilly.me} and
|
|
|
|
|
\texttt{ci.yebilly.me}.
|
|
|
|
|
|
|
|
|
|
\begin{figure}[H]
|
|
|
|
|
\centering
|
|
|
|
|
\resizebox{\linewidth}{!}{%
|
|
|
|
|
\begin{tikzpicture}[
|
|
|
|
|
box/.style={draw, rounded corners, align=center, font=\small, minimum height=1.0cm},
|
|
|
|
|
new/.style={box, fill=devopsLightBlue},
|
|
|
|
|
lbl/.style={font=\scriptsize, fill=white, inner sep=1pt},
|
|
|
|
|
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] (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] (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);
|
|
|
|
|
\draw[arr] (caddy.north) |- (gitea.west);
|
|
|
|
|
\draw[arr] (caddy.east) -- ++(0.55,0) coordinate (bus) |- (jenkins.west);
|
|
|
|
|
\draw[arr] (bus) |- node[lbl, pos=0.75, above=1pt]{HTTP} (grafana.west);
|
|
|
|
|
\draw[arr, devopsBlue] (grafana.south) -- node[lbl, right=2pt]{query API} (prom.north);
|
|
|
|
|
\draw[arr, devopsBlue] (prom.west) -- node[lbl, above=3pt]{scrape} (bbox.east);
|
|
|
|
|
\draw[arr, devopsBlue] (prom.east) -- node[lbl, above=3pt]{scrape} (node.west);
|
|
|
|
|
\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, 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,
|
|
|
|
|
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}.}
|
|
|
|
|
\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/}}
|
|
|
|
|
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
|
|
|
|
|
\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
|
|
|
|
|
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
|
|
|
|
|
whole-droplet metrics.
|
|
|
|
|
|
|
|
|
|
\paragraph{Start-up and maintenance.}
|
|
|
|
|
The deploy sequence, run on October 28, was:
|
|
|
|
|
\begin{minted}[breaklines]{sh}
|
|
|
|
|
cd ~/gitea && docker compose up -d --no-deps caddy # creates gitea_probe, new routes
|
|
|
|
|
cd ~/monitoring # copied from the laptop with scp
|
|
|
|
|
find grafana prometheus blackbox -type d -exec chmod 755 {} + \
|
|
|
|
|
&& find grafana prometheus blackbox -type f -exec chmod 644 {} +
|
|
|
|
|
docker compose config --quiet
|
|
|
|
|
docker compose pull
|
|
|
|
|
docker compose run --rm --no-deps --entrypoint /bin/promtool \
|
|
|
|
|
prometheus check config /etc/prometheus/prometheus.yml # SUCCESS
|
|
|
|
|
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
|
|
|
|
|
\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.
|
|
|
|
|
|
|
|
|
|
\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
|
|
|
|
|
all present. A restart shows persistence on the named volumes; it is not a
|
|
|
|
|
backup restore.
|
|
|
|
|
|
|
|
|
|
%---------------------------------------------------------------
|
|
|
|
|
\section{Metrics and Probes}
|
|
|
|
|
\label{Section:SREMetrics}
|
|
|
|
|
\index{Prometheus!scrape targets}
|
|
|
|
|
\index{Blackbox Exporter}
|
|
|
|
|
|
|
|
|
|
\paragraph{Scrape configuration.}
|
|
|
|
|
Prometheus takes one \gls{scrape} from each target every 30\,s. Four jobs
|
|
|
|
|
cover Prometheus itself, the two \glspl{exporter} (Node Exporter, and
|
|
|
|
|
Blackbox Exporter's own metrics), and the HTTPS probes. The probe job
|
|
|
|
|
uses the multi-target pattern: each URL becomes the probe target and the
|
|
|
|
|
\texttt{instance} label, and the scrape goes to Blackbox Exporter:
|
|
|
|
|
\begin{minted}[breaklines]{yaml}
|
|
|
|
|
- job_name: https
|
|
|
|
|
metrics_path: /probe
|
|
|
|
|
params: {module: [http_2xx]}
|
|
|
|
|
static_configs:
|
|
|
|
|
- targets: [https://git.yebilly.me/user/login, https://ci.yebilly.me/login]
|
|
|
|
|
relabel_configs:
|
|
|
|
|
- {source_labels: [__address__], target_label: __param_target}
|
|
|
|
|
- {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.
|
|
|
|
|
|
|
|
|
|
\paragraph{Probe success criteria.}
|
|
|
|
|
The \texttt{http\_2xx} module defines success as: a DNS answer, a TLS
|
|
|
|
|
certificate valid for the hostname (\texttt{insecure\_skip\_verify: false},
|
|
|
|
|
\texttt{fail\_if\_not\_ssl: true}), redirects followed, and a final 2xx status
|
|
|
|
|
within 10\,s. It checks the login page's status, not its content, so a
|
|
|
|
|
successful probe does not prove Git operations, sign-in, or a working build.
|
|
|
|
|
Both probes returned 200 with \texttt{probe\_success = 1} (Gitea 0.19\,s,
|
|
|
|
|
Jenkins 0.69\,s). The certificate expiry is also exported
|
|
|
|
|
(\texttt{probe\_ssl\_earliest\_cert\_expiry}).
|
|
|
|
|
|
|
|
|
|
\paragraph{Probe route.}
|
|
|
|
|
Blackbox Exporter resolves \texttt{git.yebilly.me} and
|
|
|
|
|
\texttt{ci.yebilly.me} through Docker's network aliases to Caddy on
|
|
|
|
|
\texttt{gitea\_probe}, so each probe passes through Caddy, TLS, and the real
|
|
|
|
|
virtual host, but not public DNS, the Cloud Firewall, or any outside network.
|
|
|
|
|
It therefore cannot detect a public DNS or Internet routing failure (improvement
|
|
|
|
|
\href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/issues/20}{issue~\#20}).
|
|
|
|
|
Because \texttt{ci.yebilly.me} is allowlisted, the Caddyfile admits exactly
|
|
|
|
|
the probe's address, \texttt{172.30.90.10/32}. Allowing the whole Docker
|
|
|
|
|
network would have been unsafe: Docker's user-space proxy presents IPv6 and
|
|
|
|
|
hair-pinned visitors with a network gateway address (first 172.18.0.1, now
|
|
|
|
|
172.30.90.1), and that address must stay denied. Table~\ref{Table:SREExposure}
|
|
|
|
|
confirms it is.
|
|
|
|
|
|
|
|
|
|
\paragraph{Host metric verification.}
|
|
|
|
|
At 14:56:37 Node Exporter's 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
|
|
|
|
|
\texttt{\{job="node",mountpoint="/",fstype="ext4"\}}. Its size,
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
\begin{table}[htbp]
|
|
|
|
|
\centering\footnotesize
|
|
|
|
|
\caption{Metric inventory used by the dashboard and alerts\label{Table:SREInventory}}
|
|
|
|
|
\begin{tabular}{@{}L{4.4cm}L{1.6cm}L{1.2cm}L{3.6cm}L{3.8cm}@{}}
|
|
|
|
|
\toprule \textbf{Metric} & \textbf{Type} & \textbf{Unit} & \textbf{Meaning} & \textbf{Limitation}\\ \midrule
|
|
|
|
|
\nolinkurl{node_cpu_seconds_total} (label \texttt{mode}) & counter & seconds & CPU time per mode since boot & Graph its rate, never the raw total; whole host, not per container\\
|
|
|
|
|
\nolinkurl{node_memory_MemAvailable_bytes} & gauge & bytes & Kernel estimate of memory available to new work without swapping & Not the same as unused RAM\\
|
|
|
|
|
\nolinkurl{node_filesystem_avail_bytes}, \nolinkurl{_size_bytes} & gauge & bytes & Free space usable by non-root users; filesystem size & Must select the real root filesystem\\
|
|
|
|
|
\texttt{up} & gauge & 0/1 & Prometheus reached the target & 1 for the probe job does not mean the probed site is up\\
|
|
|
|
|
\texttt{probe\_success} & gauge & 0/1 & Probe met the success criteria & Login page only, from inside the droplet\\
|
|
|
|
|
\nolinkurl{probe_duration_seconds} & gauge & seconds & Time of the whole probe & One sample per 30\,s; misses short spikes\\
|
|
|
|
|
\bottomrule
|
|
|
|
|
\end{tabular}
|
|
|
|
|
\end{table}
|
|
|
|
|
|
|
|
|
|
No Gitea or Jenkins application metrics were enabled; the optional extension
|
|
|
|
|
was not attempted.
|
|
|
|
|
|
|
|
|
|
%---------------------------------------------------------------
|
|
|
|
|
\section{HTTPS and Access Control}
|
|
|
|
|
\label{Section:SREAccess}
|
|
|
|
|
\index{Grafana!access control}
|
|
|
|
|
|
|
|
|
|
\paragraph{Login URLs.}
|
|
|
|
|
Gitea: \url{https://git.yebilly.me/user/login};
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
\paragraph{DNS and certificate.}
|
|
|
|
|
Billy added the \texttt{A} record \texttt{metrics} $\rightarrow$
|
|
|
|
|
147.182.178.136 at Namecheap (Figure~\ref{Figure:SREDNS}). When Caddy was
|
|
|
|
|
recreated at 14:40:57--14:41:09 with the new site block, it obtained the Let's
|
|
|
|
|
Encrypt certificate for \texttt{metrics.yebilly.me} automatically. Git and
|
|
|
|
|
Jenkins answered 200 immediately afterwards.
|
|
|
|
|
|
|
|
|
|
\begin{figure}[H]
|
|
|
|
|
\centering
|
|
|
|
|
\includegraphics[width=0.9\linewidth]{images/namecheap-metrics-dns-2026-10-28.png}
|
|
|
|
|
\caption{October 28, 2026: Namecheap host records for \texttt{yebilly.me}
|
|
|
|
|
with the new \texttt{metrics} \texttt{A} record next to \texttt{git} and
|
|
|
|
|
\texttt{ci}.}
|
|
|
|
|
\label{Figure:SREDNS}
|
|
|
|
|
\end{figure}
|
|
|
|
|
|
|
|
|
|
\paragraph{Proxy changes.}
|
|
|
|
|
The Caddyfile gained one site block and one allowlist entry (excerpt; the
|
|
|
|
|
team addresses come from the untracked \texttt{\textasciitilde/gitea/.env}):
|
|
|
|
|
\begin{minted}[breaklines]{text}
|
|
|
|
|
ci.yebilly.me {
|
|
|
|
|
@denied not remote_ip 155.246.0.0/16 172.30.90.10/32 {$CI_TEAM_IPS}
|
|
|
|
|
respond @denied 403
|
|
|
|
|
reverse_proxy jenkins:8080
|
|
|
|
|
}
|
|
|
|
|
metrics.yebilly.me {
|
|
|
|
|
@denied not remote_ip 155.246.0.0/16 {$CI_TEAM_IPS}
|
|
|
|
|
respond @denied 403
|
|
|
|
|
reverse_proxy grafana:3000
|
|
|
|
|
}
|
|
|
|
|
\end{minted}
|
|
|
|
|
Grafana's own \texttt{/metrics} endpoint is disabled
|
|
|
|
|
(\texttt{GF\_METRICS\_ENABLED=false}). The Cloud Firewall \texttt{gitea-fw}
|
|
|
|
|
and the inactive host firewall are unchanged: no rule was needed, because no
|
|
|
|
|
monitoring port is published. Before the change, the old Compose file and
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
{\small
|
|
|
|
|
\begin{tabularx}{\linewidth}{L{5.2cm}L{1.9cm}Y}
|
|
|
|
|
\caption{External exposure tests, October 28, 2026\label{Table:SREExposure}}\\
|
|
|
|
|
\toprule \textbf{Test} & \textbf{Expected} & \textbf{Actual}\\ \midrule
|
|
|
|
|
TCP 3000, 3001, 8080, 9090, 9100, 9115, 50000 on the droplet's IPv4 & no connection & no connection on all 7 \StatusPass\\
|
|
|
|
|
Same 7 ports on the droplet's IPv6 & no connection & no connection on all 7 \StatusPass\\
|
|
|
|
|
\texttt{https://metrics\ldots/login} over IPv4 (allowlisted) & 200 & 200 \StatusPass\\
|
|
|
|
|
\texttt{http://metrics.yebilly.me} & redirect & 308 to HTTPS \StatusPass\\
|
|
|
|
|
Grafana API without login (\texttt{/api/dashboards/\ldots}, data-source proxy query) & 401 & 401, 401 \StatusPass\\
|
|
|
|
|
\texttt{https://metrics\ldots/metrics} & no metrics & 302 to the login page \StatusPass\\
|
|
|
|
|
\texttt{https://git\ldots/metrics}; \texttt{https://ci\ldots/prometheus/} & no metrics & 404; 403 \StatusPass\\
|
|
|
|
|
\texttt{ci} and \texttt{metrics} login over IPv6 (not allowlisted; proxy gateway address) & 403 & 403, 403 \StatusPass\\
|
|
|
|
|
\texttt{git} login over IPv6 & 200 & 200 \StatusPass\\
|
|
|
|
|
\bottomrule
|
|
|
|
|
\end{tabularx}}
|
|
|
|
|
|
|
|
|
|
%---------------------------------------------------------------
|
|
|
|
|
\section{Dashboard and CI Correlation}
|
|
|
|
|
\label{Section:SREDashboard}
|
|
|
|
|
\index{Grafana!dashboard}
|
|
|
|
|
|
|
|
|
|
\paragraph{Dashboard.}
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
\texttt{job="node",mountpoint="/",fstype="ext4"}, the same in numerator and
|
|
|
|
|
denominator, and \texttt{G} and \texttt{J} for the Gitea and Jenkins login
|
|
|
|
|
URLs.
|
|
|
|
|
|
|
|
|
|
{\small
|
|
|
|
|
\begin{tabularx}{\linewidth}{L{3.6cm}L{1.6cm}Y}
|
|
|
|
|
\caption{Dashboard panels\label{Table:SREPanels}}\\
|
|
|
|
|
\toprule \textbf{Panel} & \textbf{Unit} & \textbf{Reading}\\ \midrule
|
|
|
|
|
1. Droplet CPU utilization & percent & Busy share averaged over CPUs, plus how much of it is waiting on disk (I/O wait); red line at 80\%\\
|
|
|
|
|
2. Available memory & bytes & \texttt{MemAvailable}; line at 100\,MiB marks low headroom\\
|
|
|
|
|
3. Root filesystem available & percent & Available over size of the verified root filesystem; line at 15\%\\
|
|
|
|
|
4. Gitea HTTPS availability & 0/1 & \texttt{probe\_success}, shown as UP/DOWN\\
|
|
|
|
|
5. Jenkins HTTPS availability & 0/1 & \texttt{probe\_success}, shown as UP/DOWN\\
|
|
|
|
|
6. HTTPS probe duration & seconds & One labelled line per service\\
|
|
|
|
|
7. Scrape health (optional) & 0/1 & \texttt{up}, one line per target\\
|
|
|
|
|
\bottomrule
|
|
|
|
|
\end{tabularx}}
|
|
|
|
|
|
|
|
|
|
\begin{minted}[breaklines]{text}
|
|
|
|
|
1 100 * (1 - avg(rate(node_cpu_seconds_total{job="node",mode="idle"}[2m])))
|
|
|
|
|
100 * avg(rate(node_cpu_seconds_total{job="node",mode="iowait"}[2m]))
|
|
|
|
|
2 node_memory_MemAvailable_bytes{job="node"}
|
|
|
|
|
3 100 * node_filesystem_avail_bytes{R} / node_filesystem_size_bytes{R}
|
|
|
|
|
4 probe_success{job="https",instance="G"}
|
|
|
|
|
5 probe_success{job="https",instance="J"}
|
|
|
|
|
6 probe_duration_seconds{job="https",instance="G"} probe_duration_seconds{job="https",instance="J"}
|
|
|
|
|
7 up
|
|
|
|
|
\end{minted}
|
|
|
|
|
|
|
|
|
|
\begin{figure}[H]
|
|
|
|
|
\centering
|
|
|
|
|
\includegraphics[width=\linewidth]{images/grafana-dashboard-2026-10-28.png}
|
|
|
|
|
\caption{October 28, 2026, 10:47--11:01 a.m.\ Eastern: \emph{Group 1 SRE}
|
|
|
|
|
about ten minutes after start-up, with all seven panels receiving data. The
|
|
|
|
|
flat lines in the CPU, memory, and disk panels are thresholds (80\%,
|
|
|
|
|
100\,MiB, 15\%), not data.}
|
|
|
|
|
\label{Figure:SREDashboard}
|
|
|
|
|
\end{figure}
|
|
|
|
|
|
|
|
|
|
\paragraph{Normal build compared with host metrics.}
|
|
|
|
|
Billy's push of \texttt{d3a5e6b} triggered Jenkins job
|
|
|
|
|
\texttt{vpn-dns-gateway~»~feature/issue-19-monitoring}, build~\#1: queued
|
|
|
|
|
15:17:33.9 (webhook), started 15:17:41.3, finished 15:17:53.1 (11.8\,s),
|
|
|
|
|
\texttt{SUCCESS} with both unit tests passing. It ran on the Jenkins
|
|
|
|
|
controller's single executor, inside the droplet's measurements; there is no
|
|
|
|
|
remote agent. Table~\ref{Table:SREBuild} compares 30\,s samples before,
|
|
|
|
|
during, and after; Figure~\ref{Figure:SREBuildWindow} shows the same window.
|
|
|
|
|
|
|
|
|
|
\begin{table}[H]
|
|
|
|
|
\centering\footnotesize
|
|
|
|
|
\caption{Host metrics around build \#1 (UTC)\label{Table:SREBuild}}
|
|
|
|
|
\begin{tabular}{@{}lrrrl@{}}
|
|
|
|
|
\toprule \textbf{Sample} & \textbf{CPU busy (1\,m)} & \textbf{Available} & \textbf{Swap used} & \\ \midrule
|
|
|
|
|
15:16:00 & 15.0\% & 169\,MiB & 695\,MiB & before\\
|
|
|
|
|
15:16:30 & 8.3\% & 175\,MiB & 688\,MiB & before\\
|
|
|
|
|
15:17:00 & 39.4\% & 104\,MiB & 650\,MiB & before (background burst)\\
|
|
|
|
|
15:17:30 & 19.0\% & 116\,MiB & 675\,MiB & \textbf{during}\\
|
|
|
|
|
15:18:00 & 32.1\% & 196\,MiB & 691\,MiB & \textbf{during}\\
|
|
|
|
|
15:18:30 & 43.7\% & 221\,MiB & 680\,MiB & after\\
|
|
|
|
|
15:19:00 & 46.4\% & 133\,MiB & 652\,MiB & after (background burst)\\
|
|
|
|
|
15:20:00 & 17.1\% & 221\,MiB & 702\,MiB & after\\
|
|
|
|
|
\bottomrule
|
|
|
|
|
\end{tabular}
|
|
|
|
|
\end{table}
|
|
|
|
|
|
|
|
|
|
No change can be attributed to the build. It lasted less than one scrape
|
|
|
|
|
interval, and its samples lie inside the 8--49\% range seen without any
|
|
|
|
|
build. Whole-host metrics also cannot attribute CPU or memory to Jenkins
|
|
|
|
|
rather than another container. The table does show a background pattern:
|
|
|
|
|
about every two minutes, CPU rose to 35--49\% and available memory fell by
|
|
|
|
|
80--120\,MiB. Sampling each container every 8\,s showed them mostly under
|
|
|
|
|
2\% CPU, with short bursts when Gitea's memory jumped from 23 to 93\,MiB and
|
|
|
|
|
Grafana's from 73 to 140\,MiB. Over 15 minutes the CPU modes were 74.3\% idle,
|
|
|
|
|
\textbf{14.7\% I/O wait}, 4.5\% system, 4.0\% user, and 1.6\% hypervisor steal.
|
|
|
|
|
The busy line is therefore mostly memory being paged back in from swap, not
|
|
|
|
|
computation. Version~2 of the dashboard added the I/O-wait line to panel~1 so
|
|
|
|
|
the dashboard shows this directly. The same pressure explains a Gitea probe
|
|
|
|
|
of about 1.9\,s, one Grafana request that failed after 4\,s, and the later
|
|
|
|
|
build~\#2 taking 34\,s.
|
|
|
|
|
|
|
|
|
|
\begin{figure}[H]
|
|
|
|
|
\centering
|
|
|
|
|
\includegraphics[width=\linewidth]{images/grafana-build-window-2026-10-28.png}
|
|
|
|
|
\caption{October 28, 2026, 11:00--11:30 a.m.\ Eastern: the build ran at
|
|
|
|
|
11:17:41--11:17:53 with no visible effect. The I/O-wait line (yellow) follows
|
|
|
|
|
the CPU-busy line, and both services stay UP.}
|
|
|
|
|
\label{Figure:SREBuildWindow}
|
|
|
|
|
\end{figure}
|
|
|
|
|
|
|
|
|
|
%---------------------------------------------------------------
|
|
|
|
|
\section{SLI, SLO, and Error Budget}
|
|
|
|
|
\label{Section:SRESLO}
|
|
|
|
|
\index{SLO}
|
|
|
|
|
\index{error budget}
|
|
|
|
|
|
|
|
|
|
\paragraph{Definitions.}
|
|
|
|
|
A \gls{sli} is a measurement; here, the fraction of scheduled HTTPS probes
|
|
|
|
|
of one service that succeed in a stated window. An \gls{slo} is the team's
|
|
|
|
|
own target for that measurement: at least 99\% probe success over a 24-hour
|
|
|
|
|
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/}}
|
|
|
|
|
The 99\% figure is an exercise target, not a reliability promise.
|
|
|
|
|
|
|
|
|
|
\paragraph{Worked example (hypothetical numbers from the instructor).}
|
|
|
|
|
At one probe every 30\,s, 24 hours contain $24 \times 120 = 2{,}880$ probes per
|
|
|
|
|
service. Suppose Gitea succeeds on all 2{,}880, and Jenkins succeeds on
|
|
|
|
|
2{,}850 and fails on 30, with no missing samples. Gitea's SLI is
|
|
|
|
|
$2{,}880/2{,}880 = 100\%$. Jenkins' is $2{,}850/2{,}880 = 98.96\%$, which
|
|
|
|
|
misses 99\%. The budget is $1\% \times 2{,}880 = 28.8$ failed probes, which
|
|
|
|
|
is $28.8 \times 30\,\text{s} = 864\,\text{s} = 14.4$ minutes if failures are
|
|
|
|
|
spread like the samples. Thirty failures exceed it by 1.2 probes, about
|
|
|
|
|
0.6 minutes. Failures come in whole probes, so 28 is the most that still
|
|
|
|
|
meets the target ($28/2{,}880 = 0.97\%$; 29 would be 1.01\%).
|
|
|
|
|
|
|
|
|
|
\paragraph{Measured short window.}
|
|
|
|
|
The window is the 10 minutes from 16:03:00 to 16:13:00 UTC on October 28,
|
|
|
|
|
which contains the whole Jenkins outage and recovery. The queries were
|
|
|
|
|
evaluated at 16:13:00 with a 30\,s scrape interval, so about 20 samples per
|
|
|
|
|
service were expected:
|
|
|
|
|
\begin{minted}[breaklines]{text}
|
|
|
|
|
100 * avg_over_time(probe_success{job="https",instance="<login URL>"}[10m])
|
|
|
|
|
count_over_time(probe_success{job="https",instance="<login URL>"}[10m])
|
|
|
|
|
sum_over_time(probe_success{job="https",instance="<login URL>"}[10m])
|
|
|
|
|
\end{minted}
|
|
|
|
|
|
|
|
|
|
\begin{table}[H]
|
|
|
|
|
\centering\footnotesize
|
|
|
|
|
\caption{Probe success, 16:03:00--16:13:00 UTC, October 28, 2026\label{Table:SREWindow}}
|
|
|
|
|
\begin{tabular}{@{}lrrrr@{}}
|
|
|
|
|
\toprule \textbf{Service} & \textbf{Expected} & \textbf{Received} & \textbf{Successful} & \textbf{Success}\\ \midrule
|
|
|
|
|
Gitea & 20 & 20 & 20 & 100\%\\
|
|
|
|
|
Jenkins & 20 & 20 & 9 & 45\%\\
|
|
|
|
|
\bottomrule
|
|
|
|
|
\end{tabular}
|
|
|
|
|
\end{table}
|
|
|
|
|
|
|
|
|
|
All expected samples arrived (16:03:20 to 16:12:50), so the window has no
|
|
|
|
|
unknown time. If samples had been missing, they would be reported as missing,
|
|
|
|
|
never counted as successes. Jenkins' 11 failed samples (16:05:20--16:10:20)
|
|
|
|
|
correspond to about 5.5 minutes of failed probes. This shows what the SLI
|
|
|
|
|
measures during a known outage. It cannot show whether the 24-hour SLO was
|
|
|
|
|
met, which would need a full day of collection, and the optional full-day
|
|
|
|
|
evaluation was not performed. As an illustration only: if those 11 were the
|
|
|
|
|
day's only failures, Jenkins would reach $2{,}869/2{,}880 = 99.62\%$ and use
|
|
|
|
|
11 of the 28.8-probe budget.
|
|
|
|
|
|
|
|
|
|
%---------------------------------------------------------------
|
|
|
|
|
\section{Alerts and Runbooks}
|
|
|
|
|
\label{Section:SREAlerts}
|
|
|
|
|
\index{alerting}
|
|
|
|
|
\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}).
|
|
|
|
|
|
|
|
|
|
{\small
|
|
|
|
|
\begin{tabularx}{\linewidth}{L{2.6cm}YY}
|
|
|
|
|
\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}\\
|
|
|
|
|
\bottomrule
|
|
|
|
|
\end{tabularx}}
|
|
|
|
|
|
|
|
|
|
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}.
|
|
|
|
|
|
|
|
|
|
\paragraph{Contact point.}
|
|
|
|
|
The \gls{contact-point} \texttt{team-alerts} uses Grafana's Discord integration
|
|
|
|
|
(Figure~\ref{Figure:SREWebhook}); resolved notifications are enabled. Because
|
|
|
|
|
it is provisioned, Grafana shows no \emph{Test} button for it, and Grafana~13
|
|
|
|
|
has removed the older test endpoint (it answers \texttt{410 Gone}). The test
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
\begin{figure}[H]
|
|
|
|
|
\centering
|
|
|
|
|
\includegraphics[width=0.8\linewidth]{images/discord-webhook-2026-10-28.png}
|
|
|
|
|
\caption{October 28, 2026: the Discord webhook \texttt{Grafana} posting to
|
|
|
|
|
\texttt{\#devops-alerts}. The URL is not shown.}
|
|
|
|
|
\label{Figure:SREWebhook}
|
|
|
|
|
\end{figure}
|
|
|
|
|
|
|
|
|
|
\begin{figure}[H]
|
|
|
|
|
\centering
|
|
|
|
|
\includegraphics[width=0.75\linewidth]{images/discord-contact-point-test-2026-10-28.png}
|
|
|
|
|
\caption{October 28, 2026, 11:05 a.m.\ Eastern: contact-point test received
|
|
|
|
|
in Discord.}
|
|
|
|
|
\label{Figure:SREContactTest}
|
|
|
|
|
\end{figure}
|
|
|
|
|
|
|
|
|
|
\paragraph{Capacity rule test.}
|
|
|
|
|
The disk was not filled. Instead, at 15:36:48 the threshold on the droplet's
|
|
|
|
|
copy of the rule file was raised from 15 to 70 (free space was 61.3\%), and
|
|
|
|
|
Grafana's alerting provisioning was reloaded without a restart. The rule went
|
|
|
|
|
\emph{Pending} at 15:36:50 and \emph{Firing} at 15:41:50, exactly the 5-minute
|
|
|
|
|
pending period, and Discord received the notification at 11:42 a.m.\ Eastern
|
|
|
|
|
(Figure~\ref{Figure:SREDiskAlert}). At 15:42:24 the file was restored to 15 and
|
|
|
|
|
reloaded; the instance cleared by 15:42:41 and Discord received
|
|
|
|
|
\emph{Resolved}. Git held 15 throughout, and the restored file's SHA-256
|
|
|
|
|
matched the committed one. The resolved message carries
|
|
|
|
|
\texttt{grafana\_state\_reason = Updated}: Grafana resolved it because the
|
|
|
|
|
rule changed back, and at that moment 61.3\% free space was well above 15\%.
|
|
|
|
|
|
|
|
|
|
\begin{figure}[H]
|
|
|
|
|
\centering
|
|
|
|
|
\includegraphics[width=0.49\linewidth]{images/discord-disk-alert-firing-2026-10-28.png}\hfill
|
|
|
|
|
\includegraphics[width=0.49\linewidth]{images/discord-disk-alert-resolved-2026-10-28.png}
|
|
|
|
|
\caption{October 28, 2026, 11:42 a.m.\ Eastern: \emph{Root disk space low}
|
|
|
|
|
firing (left; value 61.3\% under the temporary 70\% threshold) and resolved
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
%---------------------------------------------------------------
|
|
|
|
|
\section{Incident and Recovery}
|
|
|
|
|
\label{Section:SREIncident}
|
|
|
|
|
\index{incident!Jenkins outage exercise}
|
|
|
|
|
\index{blameless review}
|
|
|
|
|
|
|
|
|
|
\paragraph{Plan.}
|
|
|
|
|
The exercise stopped only Jenkins, for about three minutes and long enough to
|
|
|
|
|
notify. Gitea and monitoring stayed up, and no volume was touched. Recovery
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
\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.
|
|
|
|
|
|
|
|
|
|
{\small
|
|
|
|
|
\begin{tabularx}{\linewidth}{L{2.2cm}Y}
|
|
|
|
|
\caption{Jenkins outage exercise, October 28, 2026 (UTC)\label{Table:SREIncident}}\\
|
|
|
|
|
\toprule \textbf{Time} & \textbf{Event}\\ \midrule
|
|
|
|
|
16:05:00 & \textbf{Injection}: \texttt{docker compose stop jenkins} (stopped 16:05:06)\\
|
|
|
|
|
16:05:20 & \textbf{First failing probe} sample (\texttt{probe\_success = 0}); the probe's HTTP status is 502 from Caddy through 16:09:50\\
|
|
|
|
|
16:05:54 & Rule instance \texttt{ci} observed \emph{Pending}\\
|
|
|
|
|
16:06:52 & Rule \textbf{firing} (\emph{Alerting})\\
|
|
|
|
|
16:07 & \textbf{Notification} in \texttt{\#devops-alerts}, 12:07 p.m.\ Eastern (Figure~\ref{Figure:SREIncidentAlerts})\\
|
|
|
|
|
16:07--16:09 & \textbf{Acknowledgement}: Billy confirmed receipt to the operator; his Discord reply came after the restart\\
|
|
|
|
|
16:09:48 & \textbf{Restart}: \texttt{docker compose start jenkins}\\
|
|
|
|
|
16:10:20 & Probe receives no HTTP response (status 0) while Jenkins is starting\\
|
|
|
|
|
16:10:45 & Jenkins log: ``Jenkins is fully up and running''\\
|
|
|
|
|
16:10:50 & \textbf{First successful probe} sample\\
|
|
|
|
|
16:11:27 & Rule instance \texttt{ci} observed \emph{Normal}\\
|
|
|
|
|
16:12 & \textbf{Resolved} notification, 12:12 p.m.\ Eastern, value \texttt{A=1}\\
|
|
|
|
|
\bottomrule
|
|
|
|
|
\end{tabularx}}
|
|
|
|
|
|
|
|
|
|
\paragraph{Measured response.}
|
|
|
|
|
Taking the injection as the start, the first failed probe came after 20\,s,
|
|
|
|
|
the rule fired after 1~minute 52~seconds, and the notification arrived after
|
|
|
|
|
about 2~minutes. That is within the 2~minutes 10~seconds that the settings
|
|
|
|
|
allow. From the restart, Jenkins was fully up after 57\,s, the first
|
|
|
|
|
successful probe came after 62\,s, and the rule returned to normal after about
|
|
|
|
|
1.5~minutes. Probes failed for 5~minutes 30~seconds in total (16:05:20 to
|
|
|
|
|
16:10:50). The Gitea probe stayed at 1 throughout.
|
|
|
|
|
Figure~\ref{Figure:SREOutage} shows the outage on the dashboard.
|
|
|
|
|
|
|
|
|
|
\begin{figure}[H]
|
|
|
|
|
\centering
|
|
|
|
|
\includegraphics[width=0.49\linewidth]{images/discord-jenkins-down-firing-2026-10-28.png}\hfill
|
|
|
|
|
\includegraphics[width=0.49\linewidth]{images/discord-jenkins-down-resolved-2026-10-28.png}
|
|
|
|
|
\caption{October 28, 2026: \emph{HTTPS service down} for
|
|
|
|
|
\texttt{https://ci.yebilly.me/login}, firing at 12:07 p.m.\ (left,
|
|
|
|
|
\texttt{A=0}) and resolved at 12:12 p.m.\ Eastern (right, \texttt{A=1}).}
|
|
|
|
|
\label{Figure:SREIncidentAlerts}
|
|
|
|
|
\end{figure}
|
|
|
|
|
|
|
|
|
|
\begin{figure}[H]
|
|
|
|
|
\centering
|
|
|
|
|
\includegraphics[width=\linewidth]{images/grafana-outage-2026-10-28.png}
|
|
|
|
|
\caption{October 28, 2026, about 12:01--1:01 p.m.\ Eastern: Jenkins
|
|
|
|
|
availability is DOWN from about 12:05 to 12:11 while Gitea stays UP. Available
|
|
|
|
|
memory rises by about 400\,MiB while Jenkins is stopped, and the Jenkins probe
|
|
|
|
|
duration spikes to about 9.5\,s near 12:10, when the probe received no
|
|
|
|
|
response while Jenkins was starting (10\,s timeout).}
|
|
|
|
|
\label{Figure:SREOutage}
|
|
|
|
|
\end{figure}
|
|
|
|
|
|
|
|
|
|
\paragraph{Recovery checks.}
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
\paragraph{How this differs from a failed build.}
|
|
|
|
|
In \ChapterRef{JenkinsCI}, PR~\#15's deliberate unit-test failure
|
|
|
|
|
(Section~\ref{Section:JenkinsReview}) had Jenkins \emph{working}: it ran the
|
|
|
|
|
pipeline, reported a failed status check, and branch protection blocked the
|
|
|
|
|
merge. Here Jenkins was \emph{unavailable}: no pipeline could run, the HTTPS
|
|
|
|
|
probe failed, and the monitoring alert fired. A failed build is a code
|
|
|
|
|
problem shown in Gitea's checks. An unavailable service is an operations
|
|
|
|
|
problem, and only monitoring would report it before a developer noticed a
|
|
|
|
|
missing check.
|
|
|
|
|
|
|
|
|
|
\paragraph{Blameless review.}
|
|
|
|
|
This \gls{blameless-review} covers the planned exercise. \emph{Impact:} Jenkins' web interface and new CI runs were unavailable for
|
|
|
|
|
about 5.5~minutes; no build was queued, so no pull request was delayed, and
|
|
|
|
|
Gitea and its HTTPS service were unaffected. \emph{Cause:} a planned,
|
|
|
|
|
announced stop of the Jenkins container. \emph{Response:} the alert reached
|
|
|
|
|
the team in about 2~minutes and the documented single command restored the
|
|
|
|
|
service in about 1~minute. \emph{What went well:} detection matched the
|
|
|
|
|
configured timing; the runbook command worked; the alert carried the runbook
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
probe never leaves the droplet. Improvements, in priority order:
|
|
|
|
|
\begin{enumerate}[nosep]
|
|
|
|
|
\item \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/issues/20}{Issue~\#20}
|
|
|
|
|
(owner Vincent): add a free uptime check outside DigitalOcean for the three
|
|
|
|
|
HTTPS hostnames, notifying the same channel.
|
|
|
|
|
\item \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/issues/21}{Issue~\#21}
|
|
|
|
|
(owner Billy): remove swap churn, by resizing to 2\,GiB (CPU/RAM only,
|
|
|
|
|
reversible, with the cost recorded) or by reducing memory use, then re-measure
|
|
|
|
|
I/O wait over 24 hours.
|
|
|
|
|
\end{enumerate}
|
|
|
|
|
|
|
|
|
|
%---------------------------------------------------------------
|
|
|
|
|
\section{Manual Quality and Controls}
|
|
|
|
|
\label{Section:SREQuality}
|
|
|
|
|
|
|
|
|
|
\paragraph{Corrective actions.}
|
|
|
|
|
Problems found and fixed during this work: (1) Grafana could not read its
|
|
|
|
|
provisioning files after the Windows \texttt{scp} upload; fixed with
|
|
|
|
|
\texttt{chmod} and added to the README. (2) An alert summary written with
|
|
|
|
|
\texttt{\$\$labels} failed Grafana's template parser in a local test run before
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
\paragraph{Cost, ownership, and cleanup.}
|
|
|
|
|
No paid service was added. The droplet stays on its 1\,GiB Basic plan (listed
|
|
|
|
|
at \$6/month on October 21, 2026, see \ChapterRef{JenkinsCI}); the images
|
|
|
|
|
use about 2.4\,GB of disk, and the second swap file 1\,GB. Billy administers
|
|
|
|
|
the stack; Vincent reviews and owns issue~\#20. To remove it:
|
|
|
|
|
\texttt{docker compose stop \&\& docker compose rm -f} in
|
|
|
|
|
\texttt{\textasciitilde/monitoring}, then \texttt{docker volume rm} for the two
|
|
|
|
|
volumes if the history is not needed; revert the \texttt{metrics} block, the
|
|
|
|
|
\texttt{172.30.90.10/32} allowlist entry, and the probe network in
|
|
|
|
|
\texttt{deploy/}, and recreate Caddy; delete the \texttt{metrics} DNS record
|
|
|
|
|
and the Discord webhook. The four disabled host services can be restored with
|
|
|
|
|
\texttt{systemctl unmask} and \texttt{systemctl enable -{}-now}.
|
|
|
|
|
|
|
|
|
|
\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.
|
|
|
|
|
|
|
|
|
|
\endgroup
|