Compare commits

...

14 Commits

Author SHA1 Message Date
a3c4d0d8fb Merge pull request 'chapter5-monitoring' (#2) from chapter5-monitoring into main
Some checks failed
Build DevOps Manual PDF / build-pdf (push) Failing after 4s
Reviewed-on: #2
2026-11-04 16:38:38 +00:00
carmen-cortese
7670134c2a Complete Chapter 5 sections 1, 4, and 7 evidence
Record the post-incident PR-4 build 15 with its Gitea commit status, the
build-time dashboard comparison, the baseline commit, and CC as the
second team member who verified the deployment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 11:21:40 -05:00
carmen-cortese
b08ccbf169 Set assignment number to 7 for Chapter 5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 10:55:44 -05:00
carmen-cortese
7076fd447b Record Chapter 5 Grafana route, metrics fix, and probe approval
Add the Caddy excerpt for metrics.590hcm.dev, the verified closure of
Grafana's public /metrics, backup permissions, and the team's approval
of the Jenkins probe exception. Sections 2 and 3 now pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 10:55:15 -05:00
carmen-cortese
c8b690f85b Record Chapter 5 Grafana HTTPS and outside exposure tests
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 10:26:46 -05:00
carmen-cortese
c4b39bef9c Document Chapter 5 monitoring volume backup
Add the backup and restore procedure, the November 2 backup evidence,
and the remaining off-host copy and restore-test gaps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 11:52:20 -05:00
carmen-cortese
f910be9afc Mark Chapter 5 alerts and runbooks section passed
Record the deployed runbook_url annotations on both alert rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 11:47:59 -05:00
carmen-cortese
2f3040e3dc Record Chapter 5 incident, measured SLI, and restart persistence
Add the November 2 Jenkins incident timeline, measured detection and
restoration times, blameless review with owned issues 5 and 6, HTTPS
alert evidence, restart persistence, and the measured SLI window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 11:34:25 -05:00
carmen-cortese
65eff9cc93 Add Chapter 5 host verification, target health, and dashboard evidence
Record the free/df versus Prometheus comparison, the up query, the
six-panel dashboard, and screenshots of the disk alert test and the
team-alerts contact point.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 16:58:37 -05:00
carmen-cortese
bff2e152bb Record Chapter 5 capacity alert test evidence
Disk rule fired, emailed, and resolved on November 1 using a temporary
host-only threshold of 90; original 15% threshold restored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 16:40:48 -05:00
carmen-cortese
70c77b6368 Document Chapter 5 alert routing and Gmail SMTP sender
Both alert rules route to the team-alerts email contact point. Add the
notification grouping and delay settings, describe the Gmail SMTP
sender with host-only credentials, and record the App Password storage
hint in the Passwords table. Delivery testing remains pending.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 13:59:20 -05:00
carmen-cortese
546ccea891 Record Jenkins probe exception and image digests in Chapter 5
Document the live Caddy exception that lets the host's own public
address GET Jenkins /login, with host and external curl results from
November 1: the Jenkins probe now succeeds while public Jenkins
requests still receive 403. Mark both HTTPS probes as passing and
record the four monitoring image digests. Team approval and reload
time for the exception remain pending.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 13:29:53 -05:00
carmen-cortese
b2ddec4565 Restructure Chapter 5 into the eight required evidence sections
Rename the chapter to "Introduction to SRE: Monitoring and Reliability"
and reorganize it around the eight evidence sections and rubric rows in
dosManual v1.42 Chapter 5. Add an evidence-status table, the actual
deployment diagram, metric inventory, dashboard and alert tables, the
worked SLO example, and an incident timeline template. Completed and
pending work are marked separately; no new operational results are
claimed.

Include the chapter in the manual (version 1.12) and add monitoring
records to Hosts and Passwords, glossary terms, citations, document
history, and the AI prompt log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 13:05:56 -05:00
6091ad285e Draft Chapter 5 monitoring evidence and open checks 2026-10-30 23:05:35 +00:00
25 changed files with 1007 additions and 4 deletions

View File

@ -74,6 +74,22 @@ configuration; the student must confirm the required roles and actual names.
Human review and corrections: pending. No credentials were requested or
recorded.
\section{Chapter 5 Monitoring Restructure}
Date: November 1, 2026; contributors: CC, CLD; tool: Anthropic Claude Code
(Claude Opus 5.5). Task: compare MB's October 30 Chapter 5 draft with
Chapter 5 of \texttt{dosManual-V1.42} and restructure it into the eight
required evidence sections. Inputs: the assignment PDF; MB's draft; the
pricing-app \texttt{feature/issue-3-monitoring} configuration, README, and
runbook at commit \texttt{d1504e2591}; and CC's November 1 terminal screenshot
of \path{/home/ubuntu/monitoring}. Output used: the restructured
\ChapterRef{Monitoring}, Hosts and Passwords monitoring rows, glossary terms,
citations, and history entry. Configuration tables were transcribed from the
versioned files; operational results come only from MB's recorded October 30
observations and CC's screenshot. The review noted that the provisioned alert
rules do not select the contact point. No probe, alert, incident, restart, or
exposure result was invented; those items are marked pending. Human review:
pending.
\section{Example Record}
Date: \textit{[timestamp]}; Tool and model: \textit{[name]}; Task:
\textit{[requested outcome]}; Inputs: \textit{[sanitized constraints and

View File

@ -40,15 +40,15 @@
\definecolor{devopsLightBlue}{RGB}{232,240,247}
% Replace these values for each assignment.
\newcommand{\AssignmentTitle}{Jenkins Continuous Integration -- Group}
\newcommand{\AssignmentNumber}{5}
\newcommand{\DocumentVersion}{1.11}
\newcommand{\AssignmentTitle}{Introduction to SRE: Monitoring and Reliability -- Group}
\newcommand{\AssignmentNumber}{7}
\newcommand{\DocumentVersion}{1.12}
\newcommand{\DocumentStatus}{Review Draft}
\newcommand{\CourseNumber}{SSW 590}
\newcommand{\CourseName}{DevOps}
\newcommand{\Instructor}{Darian Muresan}
\newcommand{\Organization}{Stevens Institute of Technology}
\newcommand{\DocumentDate}{October 23, 2026}
\newcommand{\DocumentDate}{November 1, 2026}
\newcommand{\DueDate}{[Due Date and Time]}
\newcommand{\VERSION}{Version \DocumentVersion+build.\buildRun.\buildCommit}
@ -116,6 +116,7 @@
\include{devopsGitea}
\include{devopsAutomatedManualBuild}
\include{devopsJenkinsCI}
\include{devopsMonitoring}
\include{devopsExampleAssignment}
\include{devopsKanbanSetup}
\include{devopsPasswords}

View File

@ -12,6 +12,10 @@ link each entry to the changed chapter, table, figure, or controlled artifact.
\multicolumn{4}{l}{\small\itshape Document Update History (continued)}\\
\toprule \textbf{Date / Version} & \textbf{Author / contributor} & \textbf{Change} & \textbf{Sections / related tables}\\ \midrule
\endhead \bottomrule \endlastfoot
November 1, 2026 / 1.12 (review draft) & CC, CLD & Restructured the Chapter 5 monitoring draft into the eight required evidence sections under the assignment's chapter title, with an evidence-status table, actual deployment diagram, metric inventory, dashboard and alert tables, worked SLO example, and incident template. Completed and pending work are marked separately; no new operational results were added. Included the chapter in the manual and updated Hosts and Passwords with monitoring records. & \ChapterRef{Monitoring}, \ChapterRef{Hosts}, \ChapterRef{Passwords}, \ChapterRef{AIPromptLog}\\
October 30, 2026 / 1.12 (draft) & MB & Drafted Chapter 5 monitoring evidence and open checks from the October 30 Prometheus, Grafana, Node Exporter, and Blackbox Exporter deployment. & \ChapterRef{Monitoring}\\
October 23, 2026 / 1.11 (review update) & HS & Reviewed pricing application PR~2 and its Chapter 4 evidence; confirmed the failed run and successful repair, approved the pull request after the required check passed, and recorded that peer review is complete while merge and issue closure remain pending. Reviewed the corresponding Hosts and Passwords CI entries. & \ChapterRef{JenkinsCI}, \ChapterRef{Hosts}, \ChapterRef{Passwords}\\
October 23, 2026 / 1.10 (review draft) & MB, CDX & Added Jenkins CI deployment, private HTTPS access, Python agent, traceable failed/repaired PR checks, protected-main policy, external network tests, and operator procedures. Updated Hosts and Passwords with CI records; peer review and merge remain pending. & \ChapterRef{JenkinsCI}, \ChapterRef{Hosts}, \ChapterRef{Passwords}, \ChapterRef{AIPromptLog}\\

View File

@ -3,6 +3,8 @@
\newacronym{cd}{CD}{continuous delivery or continuous deployment}
\newacronym{iac}{IaC}{infrastructure as code}
\newacronym{slo}{SLO}{service-level objective}
\newacronym{sli}{SLI}{service-level indicator}
\newacronym{sla}{SLA}{service-level agreement}
\newglossaryentry{automation}{name={automation},description={A repeatable, version-controlled procedure executed by software rather than undocumented manual steps}}
\newglossaryentry{deployment}{name={deployment},description={The controlled delivery of a versioned change to an environment}}
\newglossaryentry{evidence}{name={evidence},description={A retained record of an actual execution, observation, or review}}
@ -15,3 +17,9 @@
\newglossaryentry{cimergegate}{name={merge gate},description={A protected-branch rule requiring specified verification results before normal pull-request merge}}
\newglossaryentry{ciwebhook}{name={webhook},description={An event-triggered HTTP delivery used here to notify Jenkins of Gitea repository changes}}
\newglossaryentry{ciprhead}{name={pull-request head},description={The latest proposed source commit, which must receive a fresh CI result after each corrective push}}
\newglossaryentry{sreexporter}{name={exporter},description={A process that exposes measurements from a host or service as Prometheus metrics; it is a metric endpoint, not a database}}
\newglossaryentry{sreprobe}{name={probe},description={A scheduled synthetic request, such as an HTTPS login-page check, whose success and duration are recorded as metrics}}
\newglossaryentry{sreerrorbudget}{name={error budget},description={The amount of failure an SLO permits over its window, such as 1\% of scheduled probes for a 99\% target}}
\newglossaryentry{srecontactpoint}{name={contact point},description={A Grafana notification destination, such as email or a webhook, that receives alert and resolved messages}}
\newglossaryentry{srefailuredomain}{name={failure domain},description={A set of components that fail together; monitoring on the same host as the monitored services shares their failure domain}}

View File

@ -67,3 +67,15 @@ External exposure & IPv4: 22/80/443 reachable; 3000/8080/50000 timed out. IPv6:
Ownership / recovery & Existing Lightsail administrator owns CI. Restart persistence verified; no backup/restore claim. No new cloud instance or plan purchased; billing not audited.\\
\end{longtable}
See \ChapterRef{JenkinsCI} for the actual deployment diagram and test evidence.
\section{Chapter 5 Monitoring Components}
\begin{longtable}{p{0.27\textwidth}p{0.63\textwidth}}
\textbf{Component} & \textbf{Observed October 30, 2026 unless marked pending}\\\hline
\texttt{metrics.590hcm.dev} & Planned Grafana HTTPS hostname through Caddy to private \texttt{grafana:3000}. Pending: Name.com DNS record and Caddy route.\\
Prometheus & \texttt{prom/prometheus:v3.15.1}; private 9090; 30-second scrapes; 7-day retention; named volume \texttt{prometheus\_data}.\\
Grafana OSS & \texttt{grafana/grafana:13.2.4}; private 3000 on the monitoring and existing \texttt{gitea-deploy\_internal} networks; no host port; named volume \texttt{grafana\_data}.\\
Node Exporter & \texttt{quay.io/prometheus/node-exporter:v1.12.1}; private 9100; host root, proc, and sys mounted read-only; host PID namespace; not privileged.\\
Blackbox Exporter & \texttt{quay.io/prometheus/blackbox-exporter:v0.29.1}; private 9115; probes the Gitea and Jenkins HTTPS login URLs.\\
Deployment / capacity & \path{/home/ubuntu/monitoring}, a copy of the repository's \path{monitoring/} directory. Persistent 2 GiB swap file added; 592 MiB RAM available with monitoring running in one sample. Monitoring shares the instance's failure domain.\\
\end{longtable}
See \ChapterRef{Monitoring} for the deployment diagram and evidence status.

930
devopsMonitoring.tex Normal file
View File

@ -0,0 +1,930 @@
\chapter{Introduction to SRE: Monitoring and Reliability}
\ChapterLabel{Monitoring}
\index{monitoring}\index{Prometheus}\index{Grafana}\index{service-level objective}
This chapter records the Chapter 5 monitoring deployment for the existing
Gitea and Jenkins services, following Chapter 5 of \texttt{dosManual-V1.42}.
The team continues on the AWS Lightsail \texttt{Gitea-Project} instance
approved in \ChapterRef{JenkinsCI}. Prometheus, Grafana OSS, Node Exporter,
and Blackbox Exporter were deployed on October 30, 2026. The non-secret
configuration is on branch
\href{https://git.590hcm.dev/SSW590Team/pricing-app/src/branch/feature/issue-3-monitoring/monitoring}{\texttt{feature/issue-3-monitoring}}
at commit
\href{https://git.590hcm.dev/SSW590Team/pricing-app/commit/d1504e2591b6b6fb4adad439a83a372864d9d22a}{\texttt{d1504e2591}},
proposed in draft
\href{https://git.590hcm.dev/SSW590Team/pricing-app/pulls/4}{pricing-app PR~4}
for \href{https://git.590hcm.dev/SSW590Team/pricing-app/issues/3}{issue~3}.
\textbf{Review status: deployment, collection, the dashboard, and two alert
rules are configured, and both HTTPS probes succeed. Notification delivery,
public Grafana HTTPS, restart persistence, the controlled incident, and final PDF validation
are pending. Items marked \StatusPending{} must not be read as completed.}
The eight sections below match the eight required evidence sections and
rubric rows of the assignment. Each section separates what is configured from
what has been verified.
\begin{tabularx}{\linewidth}{L{0.5cm}L{4.0cm}L{1.9cm}Y}
\caption{Chapter 5 Evidence Status by Rubric Section\label{Table:MonitoringStatus}}\\
\toprule \textbf{\#} & \textbf{Evidence section (points)} & \textbf{Status} & \textbf{Open items}\\\midrule
\endfirsthead
\toprule \textbf{\#} & \textbf{Evidence section (points)} & \textbf{Status} & \textbf{Open items}\\\midrule
\endhead
\bottomrule
\endlastfoot
1 & Deployment and reproducibility (15) & \StatusPass & Baseline commit, second-member verification (CC), restart persistence, and backup recorded.\\
2 & Metrics and probes (15) & \StatusPass & Host comparison and target health recorded (Nov.~1); Jenkins probe exception approved (Nov.~4).\\
3 & HTTPS and access control (10) & \StatusPass & Grafana HTTPS, Caddy route, and outside tests recorded; public Grafana \texttt{/metrics} closed (Nov.~4).\\
4 & Dashboard and CI correlation (15) & \StatusPass & Dashboard recorded (Nov.~1); build comparison for PR-4 build 15 (Nov.~4).\\
5 & SLI, SLO, and error budget (10) & \StatusPass & Definitions, worked example, and measured incident window (Nov.~2).\\
6 & Alerts and runbooks (15) & \StatusPass & Both rules fired, emailed, and resolved; receipt confirmed; runbook links live (Nov.~2).\\
7 & Incident and recovery (10) & \StatusPass & Exercise, timeline, review, owned issues 5 and 6, and post-incident pipeline and commit status (Nov.~2--4).\\
8 & Manual integration and traceability (10) & \StatusPending & Reviewed final commit and successful automated PDF build links.\\
\end{tabularx}
\section{Deployment and Reproducibility}
\label{sec:mon-deployment}
\subsection{Baseline and Change Plan}
Issue~3 tracks the change; implementation is on
\texttt{feature/issue-3-monitoring}, and MB is the implementation owner.
\StatusPass{} The change starts from pricing-app \texttt{main} at commit
\texttt{db64ac1} (``Add Jenkins deployment configuration and operator
notes'', October 23, 2026), the base of \texttt{feature/issue-3-monitoring}.
The last passing Jenkins run before the change is PR-2 build 2 on October 23
(\autoref{Figure:CIRepairRun}). The manual's automated PDF build is recorded
in \autoref{sec:mon-manual}.
CC, a second team member who did not deploy the stack, verified the
deployment from November 1 to 4: scrape targets and host metrics
(\autoref{sec:mon-metrics}), HTTPS and outside exposure
(\autoref{sec:mon-access}), both alert rules end to end
(\autoref{sec:mon-alerts}), the controlled incident and recovery
(\autoref{sec:mon-incident}), restart persistence, and the backup procedure
below.
The host runs Ubuntu 24.04.4 with two virtual CPUs, 2~GB RAM, and a 60~GB
root disk. Before deployment, at 22:33~UTC on October 30, about 612~MB RAM and
44~GB of the ext4 root filesystem were available. Five containers were
already running: Gitea, Jenkins, its Python agent, the Actions runner, and
Caddy. A normal Jenkins build reduced available RAM to 274~MiB before Grafana
started, so the host had little memory headroom. A persistent 2~GiB swap file
was added. At 23:00~UTC, with all four monitoring containers running,
592~MiB RAM was available and 687~MiB swap was in use. One sample showed
Grafana at approximately 207~MiB, Prometheus 43~MiB, Node Exporter 13~MiB,
and Blackbox Exporter 19~MiB. These are point observations, not a sustained
load test; swap use and build latency must be rechecked during later builds.
\subsection{Versions, Images, and Retention}
\begin{table}[htbp]\centering\small
\begin{tabular}{L{2.6cm}L{9.4cm}}
\toprule Component & Publisher image, pinned tag, and pulled digest\\\midrule
Prometheus & \texttt{prom/prometheus:v3.15.1}\newline
{\scriptsize\path{sha256:fa3302279710be2f21a8301ec17a8b4f2301fd829bd113839b3b6b02b6f191a2}}\\
Grafana OSS & \texttt{grafana/grafana:13.2.4}\newline
{\scriptsize\path{sha256:dbbc38ea21103cefb50396340cd88afec779c7e070b0a7bf5a75b4ce46651d3f}}\\
Node Exporter & \texttt{quay.io/prometheus/node-exporter:v1.12.1}\newline
{\scriptsize\path{sha256:1b4e4438faca4dd7e001dd445d161a4a2091b0fededa84093b3a8dfeae1f1be0}}\\
Blackbox Exporter & \texttt{quay.io/prometheus/blackbox-exporter:v0.29.1}\newline
{\scriptsize\path{sha256:ea1c7aa3ef3f307cd03e85f34abb604478ccb90b567fc690da0cd9776da76b13}}\\\bottomrule
\end{tabular}
\caption{Monitoring images. Tags are set in the host's \texttt{.env}, which
contains version choices only. Digests are each image's \texttt{RepoDigests}
from \texttt{docker image inspect IMAGE:TAG} on the host, November 1, 2026.}
\label{Table:MonitoringImages}
\end{table}
All four images come from the projects' own repositories
\cite{PrometheusInstall,GrafanaDocker,NodeExporter,BlackboxExporter}.
Prometheus retains seven days of time-series data, the assignment's suggested
lab starting point; about 44~GB of disk was free before deployment.
\subsection{Deployment Architecture}
\begin{figure}[htbp]\centering
\begin{tikzpicture}[box/.style={draw,rounded corners,align=center,font=\scriptsize,inner sep=4pt,minimum width=2.3cm},mon/.style={box,fill=devopsLightBlue},lbl/.style={font=\tiny,inner sep=1.5pt},>=stealth]
\node[box] (browser) at (0,0) {\textless\textless device\textgreater\textgreater\\Team / grader browser};
\node[box] (caddy) at (0,-1.6) {\textless\textless container\textgreater\textgreater\\Caddy 2.8.4 TLS proxy};
\node[box] (dest) at (5.9,-1.6) {Notification destination\\(pending)};
\node[box] (gitea) at (-4,-3.4) {Gitea 1.22.3\\private 3000};
\node[box] (jenkins) at (0,-3.4) {Jenkins 2.580.1\\private 8080};
\node[mon] (grafana) at (3.4,-3.4) {Grafana OSS\\private 3000};
\node[box] (gvol) at (6.3,-3.4) {\textless\textless volume\textgreater\textgreater\\grafana\_data};
\node[mon] (bbox) at (-2.2,-5.6) {Blackbox Exporter\\private 9115};
\node[mon] (prom) at (3.4,-5.6) {Prometheus\\private 9090};
\node[box] (pvol) at (6.3,-5.6) {\textless\textless volume\textgreater\textgreater\\prometheus\_data};
\node[mon] (node) at (3.4,-7.5) {Node Exporter\\private 9100\\host /, proc, sys (ro)};
\draw[->] (browser)--node[lbl,right]{HTTPS 443}(caddy);
\draw[->] (caddy.west)-|(gitea.north);
\draw[->] (caddy.south)--(jenkins.north);
\draw[->] (caddy.east)-|node[lbl,above,pos=0.3]{metrics (pending)}(grafana.north);
\draw[->] (grafana.south)--node[lbl,right]{query API}(prom.north);
\draw[->] (prom.west)--node[lbl,above]{scrape}(bbox.east);
\draw[->] (prom.south)--node[lbl,right]{scrape}(node.north);
\draw[->,dashed] (bbox.north)|-node[lbl,left,pos=0.2]{HTTPS probes}(-0.8,-2.5)--(-0.8,-1.6|-caddy.south);
\draw (grafana.east)--(gvol.west);
\draw (prom.east)--(pvol.west);
\draw[->,dotted] (grafana.north east)--(dest.south west);
\end{tikzpicture}
\caption{Actual deployment on the AWS Lightsail instance Gitea-Project.
Shaded boxes are the four new monitoring containers. Grafana joins Caddy's
existing \texttt{gitea-deploy\_internal} network; Prometheus and both
exporters stay on the private \texttt{monitoring} network. No monitoring port
is published on the host. Dashed: HTTPS probes through the proxy. Dotted: alert
notifications, not yet delivered.}
\label{Figure:MonitoringDeployment}
\end{figure}
Caddy runs as a container, so Grafana has no host loopback port mapping; it is
attached to the existing proxy network, declared external in Compose so it is
reused rather than recreated. Node Exporter receives the host root,
\texttt{/proc}, and \texttt{/sys} read-only and the host PID namespace, which
are needed for whole-host CPU, memory, and disk metrics. It is not privileged
and no monitoring container mounts the Docker socket. Because Node Exporter
uses the bridge network, its network-interface metrics do not represent all
host interfaces.
\subsection{Startup, Update, and Recovery}
The live deployment directory is \path{/home/ubuntu/monitoring}; it is a copy
of the repository's \path{monitoring/} directory, not a Git checkout. From that
directory:
\begin{verbatim}
docker compose config --quiet
docker compose pull
docker compose run --rm --no-deps --entrypoint /bin/promtool \
prometheus check config /etc/prometheus/prometheus.yml
docker compose up -d
docker compose ps
docker compose logs --tail=50
\end{verbatim}
Use \texttt{docker compose stop} and \texttt{docker compose start} for routine
pauses. Never run \texttt{docker compose down -v}: it deletes the named
volumes and all monitoring history. To upgrade, back up state, change one
pinned tag, pull and recreate only that service, then verify health and
persistence. Dashboards, the data source, and alert rules are provisioned
from read-only files in Git, so they can be rebuilt; Prometheus history and
Grafana runtime state cannot.
\paragraph{Backup procedure.} Each named volume is archived while its
service is briefly stopped, so the archive is consistent. Run from
\path{/home/ubuntu/monitoring}:
\begin{verbatim}
mkdir -p ~/backups
for s in prometheus grafana; do
docker compose stop $s
docker run --rm -v monitoring_${s}_data:/data:ro \
-v ~/backups:/backup alpine \
tar czf /backup/${s}_data-$(date -u +%Y%m%dT%H%MZ).tgz -C /data .
docker compose start $s
done
\end{verbatim}
To restore one service, stop it, empty its volume, extract the archive into
the volume with the same \texttt{alpine} container (\texttt{tar xzf} into
\texttt{/data}), and start it again. Before an image upgrade, take a backup
first; Grafana and Prometheus can change their storage format, so rolling
back to an older image must use the backup taken before the upgrade, not
the upgraded volume.
\StatusPass{} The procedure ran on November 2 at 16:39~UTC
(\autoref{Figure:MonitoringBackup}): \path{prometheus_data-20261102T1639Z.tgz}
(12~MB) and \path{grafana_data-20261102T1639Z.tgz} (163~MB). Each service was
down for a few seconds, and both returned to running; Grafana logged its
startup at 16:40:27~UTC. Because the Grafana archive contains its database,
both archives were restricted to mode 0600 on November 4. \StatusPending{}
The archives are on the same host, so they do not survive loss of the
instance; copy them off the host. A restore has not been tested.
\begin{figure}[htbp]\centering
\includegraphics[width=0.8\linewidth]{prism-uploads/ch5-backup.png}
\caption{Backup archives of the two monitoring volumes, November 2, 2026.}
\label{Figure:MonitoringBackup}
\end{figure}
\subsection{Restart Persistence}
\StatusPass{} After the incident on November 2, Prometheus was restarted at
16:03:58~UTC and Grafana at 16:05:12~UTC with \texttt{docker compose restart},
one at a time and without removing volumes
(\autoref{Figure:MonitoringRestart}). Afterward the dashboard loaded through
the provisioned Prometheus data source and still showed the earlier hour,
including the Jenkins outage at 15:48--15:52~UTC
(\autoref{Figure:MonitoringIncidentDashboard}). The HTTPS rule's state
history, including October 30 entries, was still present after the Grafana
restart (\autoref{Figure:MonitoringIncidentHistory}). No collection gap is
visible at the dashboard's resolution; a gap shorter than one 30-second
scrape could still exist. A restart test shows persistence, not a successful
backup restore.
\begin{figure}[htbp]\centering
\includegraphics[width=0.85\linewidth]{prism-uploads/ch5-restart-persistence.png}
\caption{Separate Prometheus and Grafana restarts with UTC timestamps,
November 2, 2026.}
\label{Figure:MonitoringRestart}
\end{figure}
\section{Metrics and Probes}
\label{sec:mon-metrics}
\subsection{Scrape Configuration and Target Health}
Prometheus scrapes every 30 seconds. The \texttt{https} job uses the
multi-target pattern: each login URL becomes the probe target and
\texttt{instance} label, and the scrape is sent to Blackbox Exporter's
\texttt{/probe} endpoint. Blackbox Exporter's own metrics are a separate job.
\begin{verbatim}
- job_name: https
metrics_path: /probe
params: {module: [http_2xx]}
static_configs:
- targets:
- https://git.590hcm.dev/user/login
- https://ci.590hcm.dev/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{verbatim}
On October 30, Prometheus reported all five configured scrape targets up:
Prometheus itself, Node Exporter, Blackbox Exporter, and the two probe
targets. For the probe targets, \texttt{up=1} means Blackbox Exporter was
scraped; it does not mean the HTTPS request succeeded.
\StatusPass{} On November 1 at 21:55:25~UTC, an \texttt{up} query in
Grafana Explore returned five series, one per target, and the graph shows
all five at 1 for the previous hour (\autoref{Figure:MonitoringTargetHealth}).
\begin{figure}[htbp]\centering
\includegraphics[width=0.85\linewidth]{prism-uploads/ch5-target-health.png}
\caption{\texttt{up} for all five scrape targets in Grafana Explore,
November 1, 2026. Times are Eastern Standard Time (UTC$-5$); 16:55:25 EST
is 21:55:25 UTC.}
\label{Figure:MonitoringTargetHealth}
\end{figure}
\subsection{Probe Success Criteria}
The \texttt{http\_2xx} module sends an IPv4 \texttt{GET} with a 10-second
timeout and full TLS verification. A probe succeeds only when DNS resolves,
the certificate and hostname are valid, and the final response is 2xx.
A login-page response is used, not a content check. A successful probe does
not show that authenticated Git operations or a Jenkins build work.
\begin{table}[htbp]\centering\small
\begin{tabular}{L{3.4cm}L{2.0cm}L{6.4cm}}
\toprule Target & Status & Observation\\\midrule
Gitea login & \StatusPass & October 30: HTTP 200 with valid TLS from the host. November 1, 18:14:58 UTC: \path{probe_success} = 1.\\
Jenkins login & \StatusPass & October 30: HTTP 403, an access-policy denial rather than an outage. November 1, 18:14:58 UTC, after the probe exception below: \path{probe_success} = 1.\\\bottomrule
\end{tabular}
\caption{HTTPS probe results. November 1 values are from an instant
\texttt{probe\_success} query against Prometheus on the host.}
\label{Table:MonitoringProbes}
\end{table}
\subsection{Jenkins Probe Exception}
Chapter 4 restricts Jenkins to the approved SSH tunnel; all other CI requests
receive 403. Blackbox Exporter probes the public hostname, so its requests
leave the instance and return through the public address. A narrow exception
in the live \path{/home/ubuntu/gitea-deploy/Caddyfile} (mounted at
\path{/etc/caddy/Caddyfile}) forwards only requests that match all three
conditions; the pre-change file is retained as \path{Caddyfile.pre-ch5}.
The excerpt below is reformatted, with its comment removed; the rules are
unchanged.
\begin{verbatim}
ci.590hcm.dev {
@ssh_tunnel remote_ip 172.18.0.1
handle @ssh_tunnel { reverse_proxy jenkins:8080 }
@probe {
remote_ip 184.193.0.32/32
method GET
path /login
}
handle @probe { reverse_proxy jenkins:8080 }
handle { respond "Jenkins requires the approved SSH tunnel." 403 }
}
\end{verbatim}
\begin{table}[htbp]\centering\small
\begin{tabular}{L{6.6cm}L{2.4cm}L{2.6cm}}
\toprule Request, November 1, 2026 & From the host & From outside Lightsail\\\midrule
\texttt{GET https://ci.590hcm.dev/login} & 200 & 403\\
\texttt{GET https://ci.590hcm.dev/} & 403 & 403\\
\texttt{GET https://git.590hcm.dev/user/login} & --- & 200\\\bottomrule
\end{tabular}
\caption{Jenkins exception tests with \texttt{curl}, about 18:15 UTC. The
outside test ran from a team member's Windows computer on a residential
connection. The exception does not open Jenkins to the Internet.}
\label{Table:MonitoringProbeException}
\end{table}
The exception trusts the instance's own public address, so any process or
container on the host, not only Blackbox Exporter, can load the Jenkins login
page. Only \texttt{GET /login} matches; the sign-in form submits a
\texttt{POST} to a different path, which the exception does not match, so it
cannot be used to authenticate. This is an intentional change to the Chapter 4 access boundary.
\StatusPass{} Caddy was reloaded with the exception on November 1, before
the first successful Jenkins probe at 18:14:58~UTC; the exact reload time was
not recorded. The previous file is kept as
\path{/home/ubuntu/gitea-deploy/Caddyfile.pre-ch5} for rollback. The
teammate who owns the Chapter 4 access policy reviewed and approved the
exception on November 4.
\subsection{Metric Inventory}
\begin{tabularx}{\linewidth}{L{3.3cm}L{1.3cm}L{1.2cm}Y}
\caption{Metric Inventory\label{Table:MetricInventory}}\\
\toprule \textbf{Metric} & \textbf{Type} & \textbf{Unit} & \textbf{Meaning and limitation}\\\midrule
\endfirsthead
\toprule \textbf{Metric} & \textbf{Type} & \textbf{Unit} & \textbf{Meaning and limitation}\\\midrule
\endhead
\bottomrule
\endlastfoot
\path{node_cpu_seconds_total} & counter & seconds & CPU time per CPU and mode. Utilization is derived from its rate, never its lifetime total. Whole host; does not attribute use to a container.\\
\path{node_memory_MemAvailable_bytes} & gauge & bytes & Kernel estimate of memory available to applications, not simply unused RAM.\\
\path{node_filesystem_avail_bytes}, \path{node_filesystem_size_bytes} & gauge & bytes & Space on the host root filesystem, selected by \texttt{device="/dev/root"}, \texttt{fstype="ext4"}, mountpoint \texttt{/}. Overlay and pseudo filesystems are excluded.\\
\texttt{up} & gauge & 0/1 & Whether Prometheus scraped the target. For the \texttt{https} job it reflects the exporter, not the probed service.\\
\path{probe_success} & gauge & 0/1 & Whether the HTTPS probe met the success criteria above.\\
\path{probe_duration_seconds} & gauge & seconds & Total probe time, including DNS, TLS, and HTTP. Measured from this host only.\\
\end{tabularx}
\subsection{Host Verification}
The root filesystem labels \texttt{/dev/root}, \texttt{ext4}, and \texttt{/}
were confirmed from the exported series. \StatusPass{} On November 1 at
21:49:23~UTC, \texttt{free -b} and \texttt{df -B1 /} ran on the host, and
Prometheus was queried for the matching Node Exporter series within the
next second (sample timestamps 21:49:23.890 to 21:49:24.481~UTC), in one
command from \path{/home/ubuntu/monitoring}.
\begin{table}[htbp]\centering\small
\begin{tabular}{L{3.0cm}L{2.6cm}L{4.2cm}L{2.8cm}}
\toprule Quantity & Host command (bytes) & Prometheus series (bytes) & Difference\\\midrule
Total memory & 1{,}998{,}614{,}528 & \path{node_memory_MemTotal_bytes} 1{,}998{,}614{,}528 & exact\\
Available memory & 839{,}430{,}144 & \path{node_memory_MemAvailable_bytes} 841{,}371{,}648 & 1.85~MiB (0.23\%)\\
Root filesystem size & 61{,}285{,}326{,}848 & \path{node_filesystem_size_bytes} 61{,}285{,}326{,}848 & exact\\
Root available & 41{,}715{,}208{,}192 & \path{node_filesystem_avail_bytes} 41{,}715{,}216{,}384 & 8{,}192 (two 4~KiB blocks)\\\bottomrule
\end{tabular}
\caption{Host verification on November 1, 2026. The filesystem series use
\texttt{device="/dev/root"}.}
\label{Table:MonitoringHostVerification}
\end{table}
Fixed sizes match exactly. Available memory and free space change from
moment to moment, so small differences are expected when the samples are
taken about one second apart. At the same time, 838{,}422{,}528 bytes
(about 800~MiB) of swap were in use and the root filesystem was 32\% used.
These are whole-host values; they do not describe any single container.
\begin{figure}[htbp]\centering
\includegraphics[width=0.9\linewidth]{prism-uploads/ch5-host-verification.png}
\caption{Host commands and Prometheus queries run together on November 1,
2026, 21:49:23~UTC.}
\label{Figure:MonitoringHostVerification}
\end{figure}
\section{HTTPS and Access Control}
\label{sec:mon-access}
\begin{table}[htbp]\centering\small
\begin{tabular}{L{2.0cm}L{5.4cm}L{4.4cm}}
\toprule Service & Login URL & Access\\\midrule
Gitea & \url{https://git.590hcm.dev/user/login} & Public HTTPS; unchanged.\\
Jenkins & \url{https://ci.590hcm.dev:8443/login} & Approved SSH tunnel only, as in \ChapterRef{JenkinsCI}; host-only probe exception in \autoref{sec:mon-metrics}.\\
Grafana & \url{https://metrics.590hcm.dev/login} & Public HTTPS through Caddy to private \texttt{grafana:3000}; individual Grafana accounts, no anonymous access.\\\bottomrule
\end{tabular}
\caption{HTTPS login URLs. No grader account is required; dashboard and alert
evidence is embedded in this chapter.}
\label{Table:MonitoringURLs}
\end{table}
Grafana requires authentication; anonymous access and self-signup are
disabled, and its root URL is set to \texttt{https://metrics.590hcm.dev/}.
The administrator password is a randomly generated, host-only file mounted
read-only into the container and excluded from Git; on November 1, 2026 the
file was observed with mode \texttt{0600}, owned by the Grafana container
user (UID 472). The default \texttt{admin:admin} login was rejected in a live
API check. Prometheus 9090, Node Exporter 9100, and Blackbox Exporter 9115 are
not published on the host. No Gitea or Jenkins metrics endpoint was enabled.
The \texttt{metrics.590hcm.dev} A record at Name.com points to
\texttt{184.193.0.32}; no AAAA record exists, so IPv6 does not apply. A team
member added the Caddy route to \texttt{grafana:3000}, which reaches Grafana
over the existing \texttt{gitea-deploy\_internal} network. Grafana's
certificate was issued by Let's Encrypt YE1 for \texttt{metrics.590hcm.dev},
valid from November 3, 2026 at 18:56:05~UTC through February 1, 2027 at
18:56:04~UTC.
\begin{table}[htbp]\centering\small
\begin{tabular}{L{5.6cm}L{2.0cm}L{4.6cm}}
\toprule Request (\texttt{curl}) & Result & Meaning\\\midrule
\path{http://metrics.590hcm.dev/} & 308 & Redirects to HTTPS.\\
\path{https://metrics.590hcm.dev/api/health} & 200 & Grafana 13.2.4, database ok; valid TLS.\\
\path{https://metrics.590hcm.dev/api/search} & 401 & Dashboards require login.\\
\path{https://git.590hcm.dev/user/login} & 200 & Gitea login public, as intended.\\
\path{https://ci.590hcm.dev/login} and \path{/} & 403 & Jenkins blocked outside the SSH tunnel.\\
\path{https://git.590hcm.dev/metrics} & 404 & No Gitea metrics endpoint.\\
\path{https://ci.590hcm.dev/prometheus} & 403 & No Jenkins metrics path reachable.\\
\texttt{184.193.0.32} ports 3000, 9090, 9100, 9115, 8080 & timeout & Not published; blocked by the firewall.\\
\path{https://metrics.590hcm.dev/metrics} & \StatusFail{} 200 & Grafana's internal metrics were public (November 3).\\
Same, after the fix (November 4, 15:41~UTC) & \StatusPass{} 302 & Redirects to the login page; no metrics returned.\\\bottomrule
\end{tabular}
\caption{External exposure tests from a team member's Windows computer on a
residential network, outside Lightsail, November 3, 2026, about
21:08~UTC.}
\label{Table:MonitoringExposure}
\end{table}
The last test found a gap. Grafana serves its own Prometheus-format metrics
at \path{/metrics} without login by default, and the new public route
exposed about 7{,}200 lines of them: version, runtime, and usage counters,
but no credentials or dashboard data. Prometheus does not scrape Grafana, so
nothing depends on this endpoint. The fix sets
\texttt{GF\_METRICS\_ENABLED: "false"} in the Grafana service in
\texttt{compose.yaml} (pricing-app commit be6829f). It was deployed on
November 4 by recreating Grafana with \texttt{docker compose up -d grafana}.
The same outside request then returned 302 to the login page and no metrics.
The Grafana route in \path{/home/ubuntu/gitea-deploy/Caddyfile} (lines
24--26) contains no secrets and is shown unchanged. Caddy obtains and renews
the certificate automatically and redirects HTTP to HTTPS:
\begin{verbatim}
metrics.590hcm.dev {
reverse_proxy grafana:3000
}
\end{verbatim}
\section{Dashboard and CI Correlation}
\label{sec:mon-dashboard}
The provisioned dashboard \emph{SSW 590 Chapter 5 -- Gitea, Jenkins and host}
(UID \texttt{ssw590-ch5-monitoring}) is versioned as
\href{https://git.590hcm.dev/SSW590Team/pricing-app/src/branch/feature/issue-3-monitoring/monitoring/grafana/dashboards/chapter5.json}{\path{monitoring/grafana/dashboards/chapter5.json}}.
It uses the \texttt{America/New\_York} time zone, a one-hour default range,
and a 30-second refresh. Grafana reaches Prometheus at
\texttt{http://prometheus:9090}. Each of the six panels returned live data on
October 30.
\begin{tabularx}{\linewidth}{L{3.0cm}L{1.3cm}Y}
\caption{Required Dashboard Panels\label{Table:MonitoringPanels}}\\
\toprule \textbf{Panel} & \textbf{Unit} & \textbf{Query and explanation}\\\midrule
\endfirsthead
\toprule \textbf{Panel} & \textbf{Unit} & \textbf{Query and explanation}\\\midrule
\endhead
\bottomrule
\endlastfoot
Whole-host CPU & percent & {\footnotesize\path{100 * (1 - avg(rate(node_cpu_seconds_total{job="node",mode="idle"}[5m])))}}. Non-idle share averaged across both CPUs over five minutes.\\
Available memory & bytes & {\footnotesize\path{node_memory_MemAvailable_bytes{job="node"}}}.\\
Available root disk & percent & {\footnotesize\path{100 * node_filesystem_avail_bytes{...} / node_filesystem_size_bytes{...}}} with the same \texttt{/dev/root}, \texttt{ext4} selector on both sides.\\
Gitea availability & 0/1 & {\footnotesize\path{probe_success{job="https",instance="https://git.590hcm.dev/user/login"}}}.\\
Jenkins availability & 0/1 & {\footnotesize\path{probe_success{job="https",instance="https://ci.590hcm.dev/login"}}}.\\
HTTPS probe duration & seconds & {\footnotesize\path{probe_duration_seconds{job="https",instance=~"https://(git|ci)[.]590hcm[.]dev/.*"}}}, one labeled line per service.\\
\end{tabularx}
\autoref{Figure:MonitoringDashboard} shows all six panels for the hour
ending about 21:56~UTC on November 1. CPU stayed below about 10\%, root disk
stayed at 68.1\% available, and both HTTPS availability panels stayed at 1.
Probe durations were mostly 10--25~ms, with short spikes up to about 115~ms.
Available memory rose by roughly 100~MiB at about 21:26 and 21:34~UTC; both
times match the Grafana restarts during the capacity alert test
(\autoref{Table:MonitoringDiskAlertTest}). Memory then fell back toward
650~MiB as Grafana warmed up, so the restarts briefly freed memory but did
not change the host's limited headroom.
\begin{figure}[htbp]\centering
\includegraphics[width=\linewidth]{prism-uploads/ch5-dashboard.png}
\caption{Chapter 5 dashboard, last hour, November 1, 2026 (15:56--16:56
EST, 20:56--21:56 UTC). The tooltip on the disk panel shows 68.1\%
available.}
\label{Figure:MonitoringDashboard}
\end{figure}
\subsection{Build Correlation}
\StatusPass{} The normal pipeline run used for this comparison is
\texttt{pricing-app} » \texttt{PR-4} build 15: commit
\texttt{be6829f}, agent \texttt{python-agent}, started by the Gitea webhook,
SUCCESS, from 10:26:56 to 10:27:13 EST on November 4, 2026 (15:26:56 to
15:27:13~UTC; full details in \autoref{Table:MonitoringPostIncidentBuild}).
The agent container runs on the same host (\ChapterRef{JenkinsCI}), so any
change appears in the whole-host panels
(\autoref{Figure:MonitoringBuildDashboard}).
\begin{table}[htbp]\centering\small
\begin{tabular}{L{2.6cm}L{3.0cm}L{3.2cm}L{3.6cm}}
\toprule Panel & Before (10:20--10:26) & During and just after the build & After\\\midrule
Host CPU & about 2--3\% & rose to about 7\% from about 10:27 to 10:31 & back to about 2--3\%\\
Available memory & about 760~MiB & fell to about 590~MiB at about 10:27 & stayed near 590~MiB until Grafana was recreated at about 10:40\\
Root disk & 68\% available & no visible change & no visible change\\
Gitea and Jenkins availability & 1 & 1 & 1\\
Probe duration & mostly under 50~ms & no visible change & mostly under 50~ms\\\bottomrule
\end{tabular}
\caption{Host metrics around PR-4 build 15, read from the dashboard. Times
are EST.}
\label{Table:MonitoringBuildCorrelation}
\end{table}
The build itself lasted 17~seconds, but CPU stayed slightly higher for about
four minutes and about 170~MiB of memory stayed in use afterward. The likely
reason is that the Jenkins controller and agent keep work and caches in
memory after a run, but whole-host metrics cannot attribute the change to a
particular process or container, so this is an inference, not a measurement.
The memory recovery at about 10:40 EST matches the Grafana recreation that
deployed the \path{/metrics} fix (\autoref{sec:mon-access}); the CPU rise
and the 1.2-second Jenkins probe spike at about 10:40--10:45 belong to that
restart, not to the build. The build did not affect Gitea or Jenkins
availability. With about 590~MiB available after a short build, the result
supports follow-up issue 6 on memory headroom.
\begin{figure}[htbp]\centering
\includegraphics[width=\linewidth]{prism-uploads/ch5-build-dashboard-top.png}\\[4pt]
\includegraphics[width=\linewidth]{prism-uploads/ch5-build-dashboard-bottom.png}
\caption{Dashboard for about 10:18 to 11:18 EST on November 4, 2026
(15:18--16:18~UTC), around PR-4 build 15 at 10:26:56--10:27:13 EST.}
\label{Figure:MonitoringBuildDashboard}
\end{figure}
\section{SLI, SLO, and Error Budget}
\label{sec:mon-slo}
\begin{table}[htbp]\centering\small
\begin{tabular}{lL{10.6cm}}
\toprule Term & Meaning in this chapter\\\midrule
\gls{sli} & The measured indicator: successful scheduled HTTPS probes divided by received scheduled probes, per service and window.\\
\gls{slo} & The internal target: at least 99\% probe success over 24 hours, evaluated separately for Gitea and Jenkins.\\
\gls{sla} & A commitment to a customer, possibly with consequences for missing it. This lab establishes no SLA.\\\bottomrule
\end{tabular}
\caption{Reliability terms, following the SRE Workbook approach \cite{SREWorkbookSLOs}.}
\label{Table:MonitoringSLOTerms}
\end{table}
\subsection{Worked Example (Hypothetical Data)}
The following figures are the assignment's illustrative dataset, not measured
results. At a 30-second interval, one complete day contains
$24 \times 3600 / 30 = 2{,}880$ scheduled probes per service. If Gitea
succeeds on all 2,880, its success is 100\%. If Jenkins succeeds on 2,850 and
fails on 30, its success is $100 \times 2850/2880 \approx 98.96\%$, which
misses the 99\% target. The error budget is the failure allowance the target
permits: $0.01 \times 2880 = 28.8$ failed samples, or $28.8 \times 30\,\text{s}
= 14.4$ minutes. Thirty failures exceed the budget by 1.2 samples, about 0.6
minutes. Because samples are whole, at most 28 failures would meet the target.
\subsection{Measured Exercise Window}
\StatusPass{} The measured window is the ten minutes from 15:45:00 to
15:55:00~UTC on November 2, 2026, which contains the whole Jenkins incident
(\autoref{sec:mon-incident}). The scrape interval for the \texttt{https} job
is 30 seconds. Both queries were run as instant queries in Grafana Explore,
fixed to the window end with the \texttt{@} modifier, so the evaluation time
does not depend on when they were run:
\begin{verbatim}
100 * avg_over_time(probe_success{job="https"}[10m] @ 1793634900)
count_over_time(probe_success{job="https"}[10m] @ 1793634900)
\end{verbatim}
Here \texttt{1793634900} is 15:55:00~UTC on November 2, 2026.
\begin{table}[htbp]\centering\small
\begin{tabular}{L{2.2cm}L{2.0cm}L{2.0cm}L{2.0cm}L{4.0cm}}
\toprule Service & Samples received & Successes & Failures & SLI (success \%)\\\midrule
Gitea & 20 of 20 & 20 & 0 & 100\%\\
Jenkins & 20 of 20 & 11 & 9 & 55\%\\\bottomrule
\end{tabular}
\caption{Measured SLI for 15:45--15:55~UTC, November 2, 2026. Successes are
the SLI multiplied by the received count.}
\label{Table:MonitoringMeasuredSLI}
\end{table}
All 20 expected samples arrived for both services, so no sample is unknown.
Nine failed Jenkins samples at 30-second spacing equal 4.5 minutes, which
matches the measured restoration time of 4~min 18~s to 4~min 48~s
(\autoref{Table:MonitoringIncidentMeasures}).
The 55\% value describes only this ten-minute window, which was chosen
because it contains the outage; it does not measure the 24-hour SLO. For
comparison only: the daily error budget at 99\% is 28.8 failed samples
(\autoref{sec:mon-slo}), so these 9 failures would use about 31\% of one
day's budget. If every other Jenkins sample that day succeeded, the day would
end at $2871/2880 = 99.69\%$, above the target. That is a hypothetical
projection, not a measured full-day result.
\begin{figure}[htbp]\centering
\includegraphics[width=0.8\linewidth]{prism-uploads/ch5-sli-avg.png}\\[4pt]
\includegraphics[width=0.8\linewidth]{prism-uploads/ch5-sli-count.png}
\caption{Instant queries for the measured window: success percentage (top)
and received sample count (bottom).}
\label{Figure:MonitoringMeasuredSLI}
\end{figure}
\section{Alerts and Runbooks}
\label{sec:mon-alerts}
\subsection{Alert Rules}
Two Grafana-managed rules are provisioned in
\href{https://git.590hcm.dev/SSW590Team/pricing-app/src/branch/feature/issue-3-monitoring/monitoring/grafana/provisioning/alerting/chapter5-alerts.json}{\path{chapter5-alerts.json}},
in folder \emph{SSW 590}, group \texttt{chapter5}, evaluated every 30
seconds \cite{GrafanaAlerting}. Both treat no data and evaluation errors as
alerting, so a collection failure is surfaced rather than reported as healthy.
\begin{tabularx}{\linewidth}{L{2.6cm}L{4.2cm}Y}
\caption{Provisioned Alert Rules\label{Table:MonitoringAlerts}}\\
\toprule \textbf{Rule} & \textbf{Condition and labels} & \textbf{Operator response}\\\midrule
\endfirsthead
\toprule \textbf{Rule} & \textbf{Condition and labels} & \textbf{Operator response}\\\midrule
\endhead
\bottomrule
\endlastfoot
HTTPS service unavailable & \path{probe_success} $= 0$ for 1 minute, per service. Owner \texttt{max}; severity critical. & Check the exporter scrape, DNS, certificate, HTTP status, proxy route, then service logs. Distinguish an unreachable login page from a failed Jenkins build.\\
Root disk below 15\% & Root disk available percentage $< 15$ for 5 minutes. Owner \texttt{max}; severity warning. & Identify filesystem growth, protect service data, remove only verified disposable files, or expand capacity. Never delete Docker volumes as cleanup.\\
\end{tabularx}
\StatusPass{} Each rule has a \texttt{runbook\_url} annotation that links to
the alert section of \path{monitoring/RUNBOOK.md} in pricing-app (commit
91f1575). It was deployed on November 2, and the rule's runbook link in
Grafana opened that file in Gitea. The link points to the PR~4 branch and
will be changed to \texttt{main} when that pull request merges.
\subsection{Notification Route}
Both rules send to a single email contact point named \texttt{team-alerts},
with resolved messages enabled. Each rule selects it directly in its
notification settings, so no separate notification policy is needed.
\begin{table}[htbp]\centering\small
\begin{tabular}{lL{8.6cm}}
\toprule Setting & Value and effect\\\midrule
Group by & \texttt{alertname}, \texttt{instance}: Gitea and Jenkins failures notify separately.\\
Group wait & 30 seconds before the first notification for a new group.\\
Group interval & 5 minutes before notifying about changes to a group.\\
Repeat interval & 4 hours before repeating an unresolved notification.\\\bottomrule
\end{tabular}
\caption{Notification grouping and delay settings, provisioned in
\texttt{chapter5-alerts.json}.}
\label{Table:MonitoringNotification}
\end{table}
Grafana OSS needs an outgoing mail service before an email contact point can
send. Grafana sends through Gmail SMTP on port 587 with mandatory STARTTLS.
The host, port, and TLS policy are in \texttt{compose.yaml}. The sender
address and a Gmail App Password are supplied in the host-only file
\path{/home/ubuntu/monitoring/secrets/smtp.env}, which Git ignores; the
repository contains only \path{smtp.env.example} with placeholders.
Changing this file requires recreating the Grafana container with
\texttt{docker compose up -d grafana}; its named volume preserves state.
\StatusPass{} The files and sender credentials were deployed on November 1
and Grafana was recreated. A contact-point test was sent from the
\texttt{team-alerts} view; the rule test below confirms end-to-end delivery
through the same route.
\begin{figure}[htbp]\centering
\includegraphics[width=0.8\linewidth]{prism-uploads/ch5-team-alerts-contact.png}
\caption{The provisioned \texttt{team-alerts} email contact point: read-only
in the UI, single email, resolved messages enabled. SMTP credentials are not
shown in Grafana.}
\label{Figure:MonitoringContactPoint}
\end{figure}
\subsection{Firing, Delivery, and Resolution}
\paragraph{Capacity rule (passed).} The disk rule was tested safely on
November 1 without filling the disk. The provisioned file was copied to a
backup, the disk rule's threshold was changed from 15 to 90 on the host only
(not in Git), and Grafana was restarted. Root disk free space was about
68.07\%, so the condition became true. After the event, the backup was
restored and Grafana was restarted again; the rule view then showed the
threshold ``Is below 15''. Times below come from the rule's state history
and the sender's mailbox, displayed in Eastern Standard Time and converted to
UTC.
\begin{table}[htbp]\centering\small
\begin{tabular}{L{4.2cm}L{2.2cm}L{6.2cm}}
\toprule Event & Time (UTC) & Evidence\\\midrule
Threshold raised to 90 & before 21:26 & Host-only edit; Grafana restarted.\\
Pending & 21:26:10 & State history: A $= 68.068493$, B $= 1$.\\
Alerting (firing) & 21:31:10 & State history: A $= 68.068266$, B $= 1$; five-minute pending period satisfied.\\
Firing email sent & 21:31 & \texttt{[FIRING:1] Root disk space below 15 percent} from ``SSW 590 Grafana'' to the \texttt{team-alerts} address.\\
Threshold restored to 15 & 21:34:10 & Rule ``last updated by Provisioning''.\\
Normal & 21:34:40 & State history: A $= 68.067959$, B $= 0$.\\
Resolved email sent & 21:34 & \texttt{[RESOLVED] Root disk space below 15 percent}, A $= 68.0679$, B $= 0$.\\\bottomrule
\end{tabular}
\caption{Capacity alert test on November 1, 2026.}
\label{Table:MonitoringDiskAlertTest}
\end{table}
The firing email followed the firing state within the 30-second group wait,
and the resolved email followed recovery within the same minute. The final
provisioned setting is the original 15\% threshold. The send times above
come from the sender's mailbox; the recipient later confirmed receipt of
both emails.
\begin{figure}[htbp]\centering
\includegraphics[width=0.8\linewidth]{prism-uploads/ch5-disk-alert-firing.png}
\caption{Disk rule firing during the test on November 1, 2026, with the
temporary threshold ``Is below 90'' and about 68.07\% free. Graph times are
Eastern Standard Time (UTC$-5$).}
\label{Figure:MonitoringDiskFiring}
\end{figure}
\begin{figure}[htbp]\centering
\includegraphics[width=0.8\linewidth]{prism-uploads/ch5-disk-alert-history.png}
\caption{Disk rule state history: Pending 16:26:10, Alerting 16:31:10, and
Normal 16:34:40 Eastern Standard Time (21:26:10, 21:31:10, and 21:34:40 UTC).}
\label{Figure:MonitoringDiskHistory}
\end{figure}
\paragraph{HTTPS rule (passed).} During the controlled Jenkins incident on
November 2, the HTTPS rule went Pending at 15:48:15, fired at 15:49:15, and
sent its firing email in the 15:49 minute. It returned to Normal at 15:52:45
and sent the resolved email at 15:54~UTC. Only the Jenkins instance fired;
Gitea stayed Normal. The recipient confirmed receipt of both emails for each
rule. Full timings are in \autoref{sec:mon-incident}
(\autoref{Table:MonitoringIncident}).
\section{Incident and Recovery}
\label{sec:mon-incident}
\StatusPass{} The controlled Jenkins incident ran on November 2, 2026,
from 15:46 to 15:54~UTC. Only the Jenkins controller was stopped; Gitea,
the Jenkins agent, and monitoring stayed up. The alert recipient confirmed
receipt of both notifications.
\subsection{Exercise Plan}
Agree on a maintenance window with the team and name who restarts Jenkins.
Confirm no build is running, keep Gitea and monitoring up, save the restart
command, and start a timestamped incident record. Stop only the Jenkins
controller for about three minutes, then restart it from
\path{/home/ubuntu/jenkins-deploy}. Restore early if the exercise exceeds its
agreed duration or affects other work. Do not remove volumes or stop the
instance.
\subsection{Timeline and Measured Times}
The stop and restart used \texttt{docker stop jenkins} and
\texttt{docker start jenkins} on the host. Each command was preceded and
followed by a UTC timestamp appended to the host file
\path{~/ch5-incident.log} (\autoref{Figure:MonitoringIncidentLog}).
\begin{table}[htbp]\centering\small
\begin{tabular}{L{3.6cm}L{2.6cm}L{6.2cm}}
\toprule Event & Time (UTC) & Source\\\midrule
Pre-check & 15:46:25 & Incident log; Jenkins availability 1.\\
Stop issued & 15:47:52 & Incident log.\\
Jenkins stopped & 15:47:57 & Incident log, after \texttt{docker stop} returned.\\
First failing probe & by 15:48:15 & Rule state history: Pending.\\
Alert firing & 15:49:15 & Rule state history: Alerting, after the one-minute pending period.\\
Notification sent & 15:49 & Sender mailbox, \texttt{[FIRING:1] HTTPS service unavailable}.\\
Notification received & confirmed & Recipient confirmed receipt; exact time not recorded.\\
Jenkins restart issued & 15:51:39 & Incident log.\\
Jenkins container started & 15:51:40 & Incident log.\\
First successful probe & 15:52:15--15:52:45 & Dashboard still 0 at 15:52:15; rule Normal at 15:52:45.\\
Alert resolved & 15:52:45 & Rule state history: Normal.\\
Resolved notification sent & 15:54 & Sender mailbox, \texttt{[RESOLVED]}.\\\bottomrule
\end{tabular}
\caption{Incident timeline, November 2, 2026. Screens displayed Eastern
Standard Time; times are converted to UTC.}
\label{Table:MonitoringIncident}
\end{table}
\begin{table}[htbp]\centering\small
\begin{tabular}{L{4.4cm}L{2.4cm}L{5.6cm}}
\toprule Measure & Value & Explanation\\\midrule
Planned outage & 3 min 43 s & Container stopped 15:47:57, started 15:51:40.\\
Time to first failing check & $\le$ 18 s & Stop to Pending; bounded by the 30-second rule evaluation.\\
Time to firing & 78 s & Stop to Alerting: about one evaluation plus the one-minute pending period.\\
Detection (stop to notification) & about 1.5 min & Email sent in the 15:49 minute, after the 15:49:15 firing.\\
Restoration (stop to first success) & 4 min 18 s -- 4 min 48 s & Includes about one minute of Jenkins startup after the container started.\\
Restart to recovery & $\le$ 65 s & 15:51:40 to 15:52:45.\\
Recovery to resolved email & about 1--2 min & Within the five-minute group interval.\\\bottomrule
\end{tabular}
\caption{Measured detection and restoration times. Precision is limited by
the 30-second evaluation interval and minute-level email timestamps.}
\label{Table:MonitoringIncidentMeasures}
\end{table}
\begin{figure}[htbp]\centering
\includegraphics[width=0.6\linewidth]{prism-uploads/ch5-incident-log.png}
\caption{Host incident log with UTC timestamps for the stop and restart.}
\label{Figure:MonitoringIncidentLog}
\end{figure}
\begin{figure}[htbp]\centering
\includegraphics[width=0.75\linewidth]{prism-uploads/ch5-incident-firing.png}
\caption{During the incident: the HTTPS rule fires for the Jenkins instance
only, while Gitea stays Normal. Times are EST (UTC$-5$).}
\label{Figure:MonitoringIncidentFiring}
\end{figure}
\begin{figure}[htbp]\centering
\includegraphics[width=0.75\linewidth]{prism-uploads/ch5-incident-history.png}
\caption{HTTPS rule state history for the Jenkins instance, read after the
Grafana restart: Pending 10:48:15, Alerting 10:49:15, Normal 10:52:45 EST on
November 2. The October 30 entries come from setup, when the Jenkins login
returned HTTP 403 before the probe exception, and are not part of this
exercise.}
\label{Figure:MonitoringIncidentHistory}
\end{figure}
\subsection{Recovery Checks}
After recovery, Jenkins HTTPS availability returned to 1 and stayed there,
and Gitea availability stayed at 1 throughout
(\autoref{Figure:MonitoringIncidentDashboard}). The dashboard also shows the
cost of a Jenkins start on this host: available memory rose by about
150~MiB while Jenkins was stopped, then fell to about 600~MiB, the lowest
value in the hour, during startup. CPU rose to about 10\%, and the Jenkins
probe took about 2.3~seconds while Jenkins was still starting.
\begin{figure}[htbp]\centering
\includegraphics[width=\linewidth]{prism-uploads/ch5-incident-dashboard.png}
\caption{Dashboard after the incident and the monitoring restarts, 10:06 to
11:06 EST (15:06--16:06 UTC). The Jenkins outage is visible at about
10:48--10:52 EST.}
\label{Figure:MonitoringIncidentDashboard}
\end{figure}
\paragraph{Pipeline, webhook, and commit status.} \StatusPass{} After the
incident, a push to the pricing-app pull request branch triggered a Jenkins
build through the Gitea webhook, with no manual start. The build record was
read from the Jenkins home directory on the host, because the Jenkins web
page is reachable only through the SSH tunnel.
\begin{table}[htbp]\centering\small
\begin{tabular}{L{3.0cm}L{9.4cm}}
\toprule Item & Value\\\midrule
Build & \texttt{pricing-app} » \texttt{PR-4} build 15\\
Result & SUCCESS\\
Commit & \path{be6829f26e50833b0e366817bbd07bc6b306727d} (\texttt{feature/issue-3-monitoring})\\
Agent & \texttt{python-agent}, workspace \path{/home/jenkins/agent/workspace/pricing-app_PR-4}\\
Start and end & November 4, 2026, 15:26:56.910 to 15:27:13.736~UTC (16.8~s)\\
Trigger & Gitea webhook on push\\\bottomrule
\end{tabular}
\caption{Post-incident pipeline run, from \texttt{build.xml} and the build
log in \texttt{/var/jenkins\_home/jobs/pricing-app/branches/PR-4/builds/15}.}
\label{Table:MonitoringPostIncidentBuild}
\end{table}
Jenkins reported the result back to Gitea: the commit shows the required
check \texttt{pricing-app/pipeline/pr-main} as successful
(\autoref{Figure:MonitoringCommitStatus}). The webhook, the pipeline, and the
commit-status integration therefore all worked after Jenkins was restarted.
The manual PDF build is recorded in \autoref{sec:mon-manual}.
\begin{figure}[htbp]\centering
\includegraphics[width=0.7\linewidth]{prism-uploads/ch5-commit-status.png}
\caption{Gitea commit status for \texttt{be6829f}: all checks successful.}
\label{Figure:MonitoringCommitStatus}
\end{figure}
\subsection{Difference from the Chapter 4 Failure}
The Chapter 4 exercise changed application code so a test failed while
Jenkins stayed available (\autoref{Figure:CIFailedGate}). This exercise
removes the Jenkins service itself while the code stays correct. The first is
caught by the merge gate; the second is caught by monitoring and alerting.
\subsection{Blameless Review}
This review describes what happened and what the system showed. It does not
assign blame.
\paragraph{Impact.} Jenkins could not be reached over HTTPS for about four
and a half minutes on November 2, from 15:47:57 to about 15:52:30~UTC. No
build was running, so no build was lost. Gitea, its repositories, and
monitoring were not affected.
\paragraph{Cause.} A planned stop of the Jenkins controller container for
this exercise. The code and configuration did not change.
\paragraph{Response.} The probe failure was visible within one evaluation,
the alert fired after the configured one-minute pending period, and the email
went out in the same minute. Jenkins was restarted after about 3 minutes 43
seconds, as planned. The alert resolved automatically, and the resolved email
followed within the five-minute group interval.
\paragraph{What went well.} The alert separated the two services: only the
Jenkins instance fired, and Gitea stayed Normal. No manual step was needed
to send or resolve the notification. The incident log, rule history, and
email timestamps agree with one another.
\paragraph{Measurement gaps.} Rule state times are rounded to the 30-second
evaluation interval, and the email times are rounded to the minute. The
acknowledgement time was not written down; only receipt was confirmed. The
exact first successful probe is known only to a 30-second window.
\paragraph{Shared failure domain.} Prometheus, Grafana, and the exporters run
on the same Lightsail instance as Gitea and Jenkins. If the instance itself
fails, collection and notification stop with it, and no alert would be sent.
This exercise tested a single service, not the whole host.
\paragraph{Follow-up issues.}
\begin{enumerate}
\item \textbf{High: add an independent external uptime check} for the Gitea
and Jenkins login pages from outside Lightsail, with notification to the
team, so a whole-host outage is still detected. Tracked as
\href{https://git.590hcm.dev/SSW590Team/pricing-app/issues/5}{pricing-app
issue 5}; owner \texttt{carmen}.
\item \textbf{Medium: protect memory headroom.} Jenkins startup lowered
available memory to about 600~MiB while about 800~MiB of swap was already in
use. Watch available memory during builds, consider container memory limits,
and resize the instance if builds slow down. Tracked as
\href{https://git.590hcm.dev/SSW590Team/pricing-app/issues/6}{pricing-app
issue 6}; owner \texttt{max}.
\end{enumerate}
Both issues were opened on November 2 and assigned in Gitea.
\section{Manual Integration and Traceability}
\label{sec:mon-manual}
This chapter is included in the team manual. The document history, the Hosts
and Passwords tables, the glossary, citations, and the AI Prompt Log are
updated for the monitoring services, the planned \texttt{metrics.590hcm.dev}
hostname, private ports, storage, and credential hints. The operator procedure
is in the
\href{https://git.590hcm.dev/SSW590Team/pricing-app/src/branch/feature/issue-3-monitoring/monitoring/RUNBOOK.md}{monitoring runbook}.
\StatusPending{} Before submission, merge pricing-app PR~4 through the normal
review and CI checks, then link the reviewed final commit and the successful
automated PDF build of this manual. The Gitea Actions workflow currently runs
only for \texttt{main} and \texttt{chapter3-validation}, so this chapter's
branch must be merged, or the workflow extended, to produce that build.

View File

@ -70,3 +70,11 @@ Gitea \texttt{jenkins-ci} & Restricted non-admin integration identity; write col
Operator SSH key & Each operator needs their own approved Lightsail access for the private browser tunnel. Do not share the owner's private key or embed it in CI containers.\\
\end{longtable}
These rows record actual CI account purposes and storage references, not secret values.
\section{Chapter 5 Monitoring Credential Boundaries}
\begin{longtable}{p{0.27\textwidth}p{0.63\textwidth}}
\textbf{Account / credential} & \textbf{Scope and non-secret storage hint}\\\hline
Grafana administrator & Random password in host-only file \path{/home/ubuntu/monitoring/grafana_admin_password}, mode 0600, owned by the Grafana container user, mounted read-only and ignored by Git. Retrieve locally with \texttt{sudo}; never paste it into reports. Default login rejected.\\
Grafana SMTP sender & Gmail account with a Gmail App Password, not the account password. Stored only in host file \path{/home/ubuntu/monitoring/secrets/smtp.env}, mode 0600, ignored by Git. Revoke the App Password in the Google account when the course ends. Redact from screenshots.\\
Prometheus and exporters & No credentials; reachable only on the private monitoring network.\\
\end{longtable}

View File

@ -118,3 +118,27 @@
author={{Jenkins Project}}, title={Controller Isolation},
howpublished={\url{https://www.jenkins.io/doc/book/security/controller-isolation/}},
note={Accessed October 23, 2026}}
@misc{SREWorkbookSLOs,
author={{Google}}, title={Implementing SLOs: The Site Reliability Workbook},
howpublished={\url{https://sre.google/workbook/implementing-slos/}},
note={Cited in dosManual version 1.42, Chapter 5}}
@misc{GrafanaAlerting,
author={{Grafana Labs}}, title={Grafana Alerting},
howpublished={\url{https://grafana.com/docs/grafana/latest/alerting/}},
note={Cited in dosManual version 1.42, Chapter 5}}
@misc{GrafanaDocker,
author={{Grafana Labs}}, title={Run Grafana Docker Image},
howpublished={\url{https://grafana.com/docs/grafana/latest/setup-grafana/installation/docker/}},
note={Cited in dosManual version 1.42, Chapter 5}}
@misc{PrometheusInstall,
author={{Prometheus Authors}}, title={Installation and Docker Persistence},
howpublished={\url{https://prometheus.io/docs/prometheus/latest/installation/}},
note={Cited in dosManual version 1.42, Chapter 5}}
@misc{NodeExporter,
author={{Prometheus Authors}}, title={Node Exporter},
howpublished={\url{https://github.com/prometheus/node_exporter}},
note={Cited in dosManual version 1.42, Chapter 5}}
@misc{BlackboxExporter,
author={{Prometheus Authors}}, title={Blackbox Exporter},
howpublished={\url{https://github.com/prometheus/blackbox_exporter}},
note={Cited in dosManual version 1.42, Chapter 5}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB