Add Prometheus/Grafana monitoring stack (refs #19)
vpn-dns-gateway/pipeline/head This commit looks good

Assignment 7 (instructor manual v1.42, Chapter 5): Prometheus, Grafana OSS,
Node Exporter and Blackbox Exporter beside Gitea/Jenkins on The-Ocean, pinned
by tag and digest, memory-capped for the 1 GiB droplet, no host ports.

- monitoring/: compose, scrape and probe config, Grafana provisioning
  (data source, Group 1 SRE dashboard, two alert rules, Discord contact
  point via env var), README with deploy/backup/rollback and runbooks,
  EVIDENCE.md with the deploy, capacity and exposure test records.
- deploy/: private probe network (172.30.90.0/28) with Caddy aliases;
  ci allowlist admits only the Blackbox address 172.30.90.10; new
  metrics.yebilly.me route behind the same allowlist.
- manual images: DNS record, Discord webhook, contact-point test, dashboard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-28 11:11:02 -04:00
co-authored by Claude Opus 5.5
parent 9b0dc4dc52
commit d3a5e6bc73
15 changed files with 1034 additions and 1 deletions
@@ -0,0 +1,88 @@
# Grafana-managed alerts. Grafana expands $VAR in the contact point, which keeps the
# webhook URL out of Git; templates use .Labels instead of $labels to avoid "$".
apiVersion: 1
contactPoints:
- orgId: 1
name: team-alerts
receivers:
- uid: team-alerts-discord
type: discord
settings:
url: $DISCORD_WEBHOOK_URL # from the untracked .env.secret
disableResolveMessage: false # resolved notifications on
groups:
- orgId: 1
name: sre
folder: SRE
interval: 30s # matches the scrape interval
rules:
- uid: https-service-down
title: HTTPS service down
condition: C
data:
- refId: A
relativeTimeRange: {from: 300, to: 0}
datasourceUid: prometheus
model:
refId: A
expr: probe_success{job="https"}
instant: true
- refId: C
datasourceUid: __expr__
model:
refId: C
type: threshold
expression: A
conditions:
- evaluator: {type: lt, params: [1]}
for: 1m
# A missing series or a failed query is a monitoring failure, not health.
noDataState: Alerting
execErrState: Error
labels: {severity: critical, owner: billy}
annotations:
summary: "{{ .Labels.instance }} HTTPS probe is failing"
description: "probe_success has been 0 for at least 1 minute. Owner: Billy (backup: Vincent)."
runbook_url: https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/main/monitoring/README.md#runbook-https-service-down
notification_settings:
receiver: team-alerts
group_by: [alertname, instance]
group_wait: 10s
group_interval: 1m
repeat_interval: 4h
- uid: root-disk-low
title: Root disk space low
condition: C
data:
- refId: A
relativeTimeRange: {from: 300, to: 0}
datasourceUid: prometheus
model:
refId: A
expr: 100 * node_filesystem_avail_bytes{job="node",mountpoint="/",fstype="ext4"} / node_filesystem_size_bytes{job="node",mountpoint="/",fstype="ext4"}
instant: true
- refId: C
datasourceUid: __expr__
model:
refId: C
type: threshold
expression: A
conditions:
- evaluator: {type: lt, params: [15]}
for: 5m
noDataState: Alerting
execErrState: Error
labels: {severity: warning, owner: billy}
annotations:
summary: "Root filesystem on The-Ocean below 15% free"
description: "Available space on / has stayed under 15% for 5 minutes. Owner: Billy (backup: Vincent)."
runbook_url: https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/main/monitoring/README.md#runbook-root-disk-space-low
notification_settings:
receiver: team-alerts
group_by: [alertname]
group_wait: 10s
group_interval: 1m
repeat_interval: 4h
@@ -0,0 +1,8 @@
apiVersion: 1
providers:
- name: sre
folder: SRE
type: file
allowUiUpdates: false # Git is the source of truth for the dashboard
options:
path: /var/lib/grafana-dashboards
@@ -0,0 +1,11 @@
apiVersion: 1
datasources:
- name: Prometheus
uid: prometheus
type: prometheus
access: proxy
url: http://prometheus:9090 # service name; localhost would be the Grafana container
isDefault: true
editable: false
jsonData:
timeInterval: 30s