\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) & \StatusPending & Backup procedure, restart-persistence test.\\ 2 & Metrics and probes (15) & \StatusPending & Host comparison and target health recorded (Nov.~1). Team approval and reload time of the Jenkins probe exception.\\ 3 & HTTPS and access control (10) & \StatusPending & Public Grafana hostname; external exposure tests.\\ 4 & Dashboard and CI correlation (15) & \StatusPending & Dashboard screenshot recorded (Nov.~1). Normal-build before/during/after comparison.\\ 5 & SLI, SLO, and error budget (10) & \StatusPending & Measured short-window results from the incident exercise.\\ 6 & Alerts and runbooks (15) & \StatusPending & Capacity rule fired, emailed, and resolved (Nov.~1). HTTPS rule awaits the incident; recipient receipt confirmation.\\ 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}{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. \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. \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. \StatusPending{} Record the team's approval of the exception and when Caddy was reloaded with it. \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 & \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"}}}.\\ 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} \StatusPending{} 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. \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. \StatusPending{} Record the recipient's confirmation of receipt; the evidence above is from the sender's mailbox. \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.} \StatusPending{} Record firing, delivery, and resolution for the HTTPS availability rule during the controlled Jenkins incident in \autoref{sec:mon-incident}. Redact destination secrets from screenshots. \section{Incident and Recovery} \label{sec:mon-incident} \StatusPending{} The controlled Jenkins incident has not been run. The Jenkins probe now succeeds; the exercise still depends on working notifications, so the alert can be delivered and resolved. \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.