devOpsManual/devopsMonitoring.tex
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

461 lines
26 KiB
TeX

\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. Notification delivery, the Jenkins probe, 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) & \StatusPending & Image digests, backup procedure, restart-persistence test.\\
2 & Metrics and probes (15) & \StatusPending & Successful Jenkins probe; recorded \texttt{free -b} and \texttt{df -B1 /} comparison.\\
3 & HTTPS and access control (10) & \StatusPending & Public Grafana hostname; external exposure tests.\\
4 & Dashboard and CI correlation (15) & \StatusPending & Normal-build before/during/after comparison; dashboard screenshots.\\
5 & SLI, SLO, and error budget (10) & \StatusPending & Measured short-window results from the incident exercise.\\
6 & Alerts and runbooks (15) & \StatusPending & Notification transport, rule routing, firing/delivery/resolution of both rules, capacity test.\\
7 & Incident and recovery (10) & \StatusPending & Entire exercise, review, and two owned improvement issues.\\
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.
\StatusPending{} The second team member who verifies the deployment, the
starting commit, and the passing Jenkins and manual builds recorded before
the change still need to be named and linked here.
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}{lll}
\toprule Component & Publisher image & Pinned tag\\\midrule
Prometheus & \texttt{prom/prometheus} & \texttt{v3.15.1}\\
Grafana OSS & \texttt{grafana/grafana} & \texttt{13.2.4}\\
Node Exporter & \texttt{quay.io/prometheus/node-exporter} & \texttt{v1.12.1}\\
Blackbox Exporter & \texttt{quay.io/prometheus/blackbox-exporter} & \texttt{v0.29.1}\\\bottomrule
\end{tabular}
\caption{Monitoring images. Tags are set in the host's \texttt{.env}, which
contains version choices only. \StatusPending{} Record each image's
\texttt{RepoDigests} from \texttt{docker image inspect IMAGE:TAG}.}
\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. \StatusPending{} Document the backup procedure
for the two named volumes and the rollback compatibility check.
\subsection{Restart Persistence}
\StatusPending{} Restart Prometheus and Grafana separately without deleting
volumes. Record the restart times, then verify that earlier time-series
history, the dashboard, the data source, and both alert rules remain, and
record any collection gap. A restart test shows persistence, not a successful
backup restore.
\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.
\StatusPending{} Add a labeled screenshot of the target view or an
\texttt{up} query in Grafana Explore.
\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, October 30, 2026\\\midrule
Gitea login & \StatusPass & HTTP 200 with valid TLS from the host.\\
Jenkins login & \StatusFail & HTTP 403 with valid TLS. Caddy permits CI requests only through the approved SSH tunnel (\ChapterRef{JenkinsCI}); this is an access-policy denial, not a Jenkins outage.\\\bottomrule
\end{tabular}
\caption{HTTPS probe results. \StatusPending{} Rerun after the Jenkins probe route is resolved.}
\label{Table:MonitoringProbes}
\end{table}
\StatusPending{} A narrow internal exception allowing only the monitoring
network to reach \texttt{/login} has been proposed but not applied. The
existing public restriction remains until the team approves the exact rule.
After it is applied, verify that the probe receives 200 and that other public
CI requests still receive 403.
\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. \StatusPending{} Record a side-by-side
comparison, at nearby timestamps, of \path{node_memory_MemTotal_bytes} and
\path{node_memory_MemAvailable_bytes} with \texttt{free -b}, and of the root
filesystem size and available bytes with \texttt{df -B1 /}.
\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; unchanged from \ChapterRef{JenkinsCI}.\\
Grafana & \texttt{https://metrics.590hcm.dev/} & \StatusPending{} DNS and Caddy route not yet created.\\\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.
\StatusPending{} Create the \texttt{metrics.590hcm.dev} record at Name.com and
a Caddy route to \texttt{grafana:3000}. Then, from a machine outside
Lightsail, test the Gitea, Jenkins, and Grafana login pages and confirm that
ports 9090, 9100, 9115, and 3000 and any metrics paths are unreachable over
IPv4 (and IPv6 where enabled). Record the source, commands, results, and date
in a table like \autoref{Table:CIExposure}, and include the relevant
sanitized Caddy excerpt.
\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"}}}. Currently 0 because of the access-policy denial.\\
HTTPS probe duration & seconds & {\footnotesize\path{probe_duration_seconds{job="https",instance=~"https://(git|ci)[.]590hcm[.]dev/.*"}}}, one labeled line per service.\\
\end{tabularx}
\StatusPending{} Add labeled screenshots of all six panels. Then capture host
metrics before, during, and after one normal run of the existing Jenkins
pipeline, annotated with the build ID, commit, start and end times, and
execution location. Builds run on the Python agent container on the same
host (\ChapterRef{JenkinsCI}), so any change appears in whole-host metrics.
Explain the observed change or why none was visible; whole-host correlation
does not attribute CPU or memory to Jenkins alone.
\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}
\StatusPending{} After the controlled incident, record the exact window start
and end, time zone, scrape interval, and query evaluation time. Report both
services with
\begin{verbatim}
100 * avg_over_time(probe_success{job="https",
instance="https://ci.590hcm.dev/login"}[10m])
count_over_time(probe_success{job="https",
instance="https://ci.590hcm.dev/login"}[10m])
\end{verbatim}
and the equivalent Gitea queries. Compare the received count with about 20
expected samples. Missing samples are unknown and are not counted as
successes. A short window cannot establish the 24-hour SLO; full-day
evaluation is optional.
\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}
\StatusPending{} Add a live runbook link to each rule's annotations once the
manual is published, and record the notification grouping and delay settings
actually used.
\subsection{Notification Route}
A contact point named \emph{Chapter 5 owner email} is provisioned with
resolved messages enabled. \StatusPending{} Three gaps remain:
\begin{enumerate}
\item Grafana has no outgoing mail transport, so email cannot be delivered.
The team must either configure the \texttt{[smtp]} settings with credentials
kept outside Git, or switch to an approved team-controlled webhook or chat
integration, which the assignment notes avoids SMTP configuration.
\item The provisioned files neither select this contact point in either rule
nor provision a notification policy that routes to it. Routing must be
configured and confirmed for both rules.
\item The assignment names the contact point \texttt{team-alerts}; rename it
or document the difference.
\end{enumerate}
\subsection{Firing, Delivery, and Resolution}
\StatusPending{} Send a contact-point test and confirm receipt. Then record
timestamped firing, delivery, and resolved notifications for each rule. Test
the capacity rule safely by temporarily raising its threshold above the
current free-space percentage, waiting through the five-minute pending
period, then restoring 15\% and confirming resolution. Never fill the disk.
Record the temporary change and the restored final setting, and redact
destination secrets from screenshots.
\section{Incident and Recovery}
\label{sec:mon-incident}
\StatusPending{} The controlled Jenkins incident has not been run. It depends
on a successful Jenkins probe and working notifications, so the alert can
fire and recover.
\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}
\begin{table}[htbp]\centering\small
\begin{tabular}{lll}
\toprule Event & Time (UTC) & Source\\\midrule
Jenkins stopped & \StatusPending & incident record\\
First failing probe & \StatusPending & Prometheus\\
Alert firing & \StatusPending & Grafana\\
Notification received & \StatusPending & destination\\
Acknowledged & \StatusPending & incident record\\
Jenkins restarted & \StatusPending & incident record\\
First successful probe & \StatusPending & Prometheus\\
Resolved notification & \StatusPending & destination\\\bottomrule
\end{tabular}
\caption{Incident timeline. Detection time runs from the stop to the
notification; restoration time runs from the stop to the first successful
probe. Compare both with the configured scrape, evaluation, and pending
intervals.}
\label{Table:MonitoringIncident}
\end{table}
\subsection{Recovery Checks}
\StatusPending{} After recovery, verify Jenkins HTTPS and a passing pipeline,
Gitea and its webhook and commit-status integration, and the manual PDF build.
Include outage graphs from the dashboard.
\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}
\StatusPending{} Record impact, timeline, evidence, cause, response, and
measurement gaps. Create two prioritized improvement issues in Gitea with
owners, and link them here. The review must state the shared failure domain:
monitoring runs on the same Lightsail instance as Gitea and Jenkins, so an
instance outage would also stop collection and notifications. An independent
external check should be proposed as one improvement.
\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.