chapter5-monitoring #2

Merged
carmen merged 13 commits from chapter5-monitoring into main 2026-11-04 16:38:38 +00:00
8 changed files with 526 additions and 76 deletions
Showing only changes of commit b2ddec4565 - Show all commits

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}{6}
\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.

View File

@ -1,83 +1,460 @@
\chapter{Service Monitoring and Reliability}
\chapter{Introduction to SRE: Monitoring and Reliability}
\ChapterLabel{Monitoring}
\index{monitoring}\index{Prometheus}\index{Grafana}
\index{monitoring}\index{Prometheus}\index{Grafana}\index{service-level objective}
This chapter records the Chapter 5 deployment on October 30, 2026. The
single-operator team uses the existing AWS Lightsail \texttt{Gitea-Project}
instance. The monitoring configuration is in the draft
\href{https://git.590hcm.dev/SSW590Team/pricing-app/pulls/4}{pricing-app pull request 4}.
The host is also the failure domain for Gitea and Jenkins; a host outage
would interrupt this monitoring stack. The status below separates observed
results from tests that are still pending.
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.}
\section{Deployment and Architecture}
The host runs Ubuntu 24.04.4, two virtual CPUs, 2 GB RAM, and a 60 GB root
disk. Docker Compose deploys Prometheus 3.15.1, Grafana OSS 13.2.4,
Node Exporter 1.12.1, and Blackbox Exporter 0.29.1 alongside Gitea,
Jenkins, its Python agent, the Actions runner, and Caddy. Monitoring ports
are private to Docker. Prometheus and Grafana use persistent named volumes.
Grafana authenticates users; anonymous access and signup are disabled.
Its administrator password is a host-only, read-only mounted secret and is
excluded from Git. The default credential was rejected in a live API check.
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.
The 2 GB host reached 274 MiB available RAM during a normal Jenkins build
before Grafana started. 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. Grafana used approximately 207 MiB, Prometheus
43 MiB, Node Exporter 13 MiB, and Blackbox Exporter 19 MiB in one sample.
This is a point observation, not a sustained load test; build-time swap and
latency must continue to be checked.
\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{Collection and Dashboard Evidence}
Prometheus reported all five configured scrape targets up. The Gitea login
HTTPS probe passed with HTTP 200 and valid TLS. The Jenkins login probe
returned HTTP 403 because Caddy currently permits Jenkins access only through
an SSH tunnel. This failure reflects the probe access policy and must not be
reported as a Jenkins outage. A narrow internal \texttt{/login} exception is
proposed but has not been applied. The existing public restriction remains.
\section{Deployment and Reproducibility}
\label{sec:mon-deployment}
Grafana's provisioned dashboard has six live-tested panels: whole-host CPU,
available host memory, available root disk percentage, Gitea HTTPS
availability, Jenkins HTTPS availability, and HTTPS probe duration. The
root filesystem series uses device \texttt{/dev/root}, filesystem type
\texttt{ext4}, and mountpoint \texttt{/}. The Jenkins panel currently shows
zero because of the policy denial. Grafana is reachable on its private Docker
address; public \texttt{metrics.590hcm.dev} DNS and the Caddy HTTPS route are
pending. The authoritative DNS provider is Name.com.
\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.
\section{SLI, SLO, and Alerting}
The lab service-level indicator is the number of successful scheduled HTTPS
probes divided by the number of received scheduled probes for each service
and window. Missing samples are unknown and are not counted as successes.
The proposed lab objective is at least 99\% probe success over 24 hours,
separately for Gitea and Jenkins; this is not a customer SLA. At 30-second
spacing, a complete day has 2,880 samples and a 1\% failure budget of 28.8
samples, or 14.4 minutes. For illustration only, 2,850 successes in 2,880
Jenkins probes yield 98.958\%, below the objective. No measured 24-hour
result is claimed 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.
Two Grafana-managed rules are provisioned: an HTTPS probe failure for one
minute, and root disk availability below 15\% for five minutes. Both mark
missing data and evaluation errors as alerting. The owner email contact
\texttt{mbarber1@stevens.edu} is provisioned with resolved messages enabled.
Grafana OSS has no SMTP sender configured, so notification delivery has not
been demonstrated. Routing and delivery should be tested only after a working
mail transport is supplied and the Jenkins probe access issue is resolved.
\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}
\section{Pending Exercise and Acceptance Evidence}
A controlled Jenkins stop and restart remains pending. First verify that the
Blackbox login probe can succeed without widening general public access and
that no build is running. Then record UTC timestamps for the stop, first
failed probe, alert firing, notification receipt, restart, first successful
probe, and resolved message. Calculate detection and recovery intervals from
those named events. Verify a passing Jenkins pipeline afterward. Restart
Prometheus and Grafana separately without deleting volumes; confirm retained
history, dashboard, data source, and rules. The incident review should state
impact, cause, response, measurement gaps, and owned follow-ups. An
independent external check is needed to cover failure of the shared host.
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.
The complete operator procedure and current evidence are in the
\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}.
This chapter is a review draft until public Grafana HTTPS, trustworthy Jenkins
probing, notification delivery, outage measurements, and final PDF validation
are complete.
\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.\\
Notification destination & Pending: SMTP credential or webhook URL. Must be supplied locally outside Git and redacted 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}}