Add Prometheus/Grafana monitoring stack and Grafana route (#11)
seat-back-trivia/pipeline/head This commit looks good
seat-back-trivia/pipeline/head This commit looks good
Four pinned containers on a private network with memory caps for the 512 MB droplet; provisioned data source, six-panel dashboard, HTTPS-availability and root-disk alert rules, and the team-alerts Discord contact point. The Discord webhook comes from the untracked grafana.secrets.env. Bring deploy/Caddyfile in line with the droplet (ci route) and add metrics.pollefeys.dev. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
55ab869735
commit
adb8d5fab1
@@ -1,3 +1,7 @@
|
||||
node_modules/
|
||||
.env
|
||||
*.log
|
||||
|
||||
# Monitoring: commit the pinned versions, never the Grafana secrets.
|
||||
!deploy/monitoring/.env
|
||||
deploy/monitoring/grafana.secrets.env
|
||||
|
||||
@@ -3,3 +3,10 @@
|
||||
git.pollefeys.dev {
|
||||
reverse_proxy gitea:3000
|
||||
}
|
||||
ci.pollefeys.dev {
|
||||
reverse_proxy jenkins:8080
|
||||
}
|
||||
# Grafana joins gitea_gitea-net from the monitoring Compose project.
|
||||
metrics.pollefeys.dev {
|
||||
reverse_proxy grafana:3000
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# Pinned releases of the four monitoring images (amd64). Version choices only,
|
||||
# never secrets: Grafana's Discord webhook lives in grafana.secrets.env.
|
||||
PROMETHEUS_TAG=v3.15.1
|
||||
GRAFANA_TAG=12.4.14
|
||||
NODE_EXPORTER_TAG=v1.12.1
|
||||
BLACKBOX_TAG=v0.29.1
|
||||
@@ -0,0 +1,16 @@
|
||||
# A probe succeeds only if DNS resolves over IPv4, the TLS certificate is valid
|
||||
# for the hostname, redirects (if any) are followed, the final hop is HTTPS,
|
||||
# and the final response is HTTP 200, all within 10 s.
|
||||
modules:
|
||||
http_2xx:
|
||||
prober: http
|
||||
timeout: 10s
|
||||
http:
|
||||
method: GET
|
||||
preferred_ip_protocol: ip4
|
||||
ip_protocol_fallback: false
|
||||
valid_status_codes: [200]
|
||||
follow_redirects: true
|
||||
fail_if_not_ssl: true
|
||||
tls_config:
|
||||
insecure_skip_verify: false
|
||||
@@ -0,0 +1,89 @@
|
||||
# Seat-Back Trivia monitoring on the ssw-590 droplet: Prometheus, Grafana OSS,
|
||||
# Node Exporter, and Blackbox Exporter. Nothing here publishes a host port.
|
||||
# Prometheus and the exporters sit only on the private monitoring network.
|
||||
# Grafana also joins the existing gitea_gitea-net so the Caddy container can
|
||||
# proxy https://metrics.pollefeys.dev to grafana:3000.
|
||||
# The droplet has 512 MB of RAM, so every container has a hard memory cap.
|
||||
name: monitoring
|
||||
|
||||
services:
|
||||
prometheus:
|
||||
image: prom/prometheus:${PROMETHEUS_TAG:?choose a release}
|
||||
restart: unless-stopped
|
||||
command:
|
||||
- --config.file=/etc/prometheus/prometheus.yml
|
||||
- --storage.tsdb.path=/prometheus
|
||||
- --storage.tsdb.retention.time=7d
|
||||
- --storage.tsdb.retention.size=256MB
|
||||
volumes:
|
||||
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
||||
- prometheus_data:/prometheus
|
||||
mem_limit: 160m
|
||||
networks: [monitoring]
|
||||
depends_on: [node-exporter, blackbox-exporter]
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana:${GRAFANA_TAG:?choose a release}
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
GF_SERVER_DOMAIN: metrics.pollefeys.dev
|
||||
GF_SERVER_ROOT_URL: https://metrics.pollefeys.dev/
|
||||
GF_AUTH_ANONYMOUS_ENABLED: "false"
|
||||
GF_USERS_ALLOW_SIGN_UP: "false"
|
||||
GF_SECURITY_COOKIE_SECURE: "true"
|
||||
# Grafana's own /metrics would otherwise be public through Caddy.
|
||||
GF_METRICS_ENABLED: "false"
|
||||
GF_ANALYTICS_REPORTING_ENABLED: "false"
|
||||
GF_ANALYTICS_CHECK_FOR_UPDATES: "false"
|
||||
GF_ANALYTICS_CHECK_FOR_PLUGIN_UPDATES: "false"
|
||||
GF_PLUGINS_PREINSTALL_DISABLED: "true"
|
||||
GF_NEWS_NEWS_FEED_ENABLED: "false"
|
||||
GF_DATE_FORMATS_DEFAULT_TIMEZONE: UTC
|
||||
# DISCORD_WEBHOOK_URL for the team-alerts contact point. Untracked, mode 600.
|
||||
env_file: grafana.secrets.env
|
||||
volumes:
|
||||
- grafana_data:/var/lib/grafana
|
||||
- ./grafana/provisioning:/etc/grafana/provisioning:ro
|
||||
- ./grafana/dashboards:/etc/grafana/dashboards:ro
|
||||
mem_limit: 192m
|
||||
networks: [monitoring, proxy]
|
||||
depends_on: [prometheus]
|
||||
|
||||
node-exporter:
|
||||
image: quay.io/prometheus/node-exporter:${NODE_EXPORTER_TAG:?choose a release}
|
||||
restart: unless-stopped
|
||||
pid: host
|
||||
command:
|
||||
- --path.rootfs=/host
|
||||
- --path.procfs=/host/proc
|
||||
- --path.sysfs=/host/sys
|
||||
# Only what the dashboard and alerts use, to keep Prometheus small.
|
||||
- --collector.disable-defaults
|
||||
- --collector.cpu
|
||||
- --collector.meminfo
|
||||
- --collector.filesystem
|
||||
- --collector.loadavg
|
||||
- --collector.uname
|
||||
volumes:
|
||||
- /:/host:ro,rslave
|
||||
mem_limit: 32m
|
||||
networks: [monitoring]
|
||||
|
||||
blackbox-exporter:
|
||||
image: quay.io/prometheus/blackbox-exporter:${BLACKBOX_TAG:?choose a release}
|
||||
restart: unless-stopped
|
||||
command: ["--config.file=/config/blackbox.yml"]
|
||||
volumes:
|
||||
- ./blackbox/blackbox.yml:/config/blackbox.yml:ro
|
||||
mem_limit: 32m
|
||||
networks: [monitoring]
|
||||
|
||||
networks:
|
||||
monitoring:
|
||||
proxy:
|
||||
external: true
|
||||
name: gitea_gitea-net
|
||||
|
||||
volumes:
|
||||
prometheus_data:
|
||||
grafana_data:
|
||||
@@ -0,0 +1,605 @@
|
||||
{
|
||||
"uid": "seatback-sre",
|
||||
"title": "Seat-Back Trivia SRE",
|
||||
"tags": [
|
||||
"sre",
|
||||
"assignment-7"
|
||||
],
|
||||
"timezone": "utc",
|
||||
"editable": false,
|
||||
"graphTooltip": 1,
|
||||
"refresh": "30s",
|
||||
"time": {
|
||||
"from": "now-6h",
|
||||
"to": "now"
|
||||
},
|
||||
"schemaVersion": 39,
|
||||
"version": 1,
|
||||
"description": "ssw-590 droplet health and Gitea/Jenkins HTTPS availability. Source: deploy/monitoring in SeatBackTrivia/seat-back-trivia.",
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": {
|
||||
"type": "grafana",
|
||||
"uid": "-- Grafana --"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
}
|
||||
]
|
||||
},
|
||||
"panels": [
|
||||
{
|
||||
"id": 1,
|
||||
"type": "timeseries",
|
||||
"title": "Droplet CPU utilization",
|
||||
"description": "Whole-droplet CPU busy %, averaged across all CPUs: 100 minus the idle rate over 2 minutes (four 30 s samples). node_cpu_seconds_total is a counter, so it is rated, never graphed raw. Includes every process on the host, not only Jenkins.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 8,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"lineInterpolation": "linear",
|
||||
"thresholdsStyle": {
|
||||
"mode": "line+area"
|
||||
}
|
||||
},
|
||||
"unit": "percent",
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "orange",
|
||||
"value": 80
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 95
|
||||
}
|
||||
]
|
||||
},
|
||||
"min": 0,
|
||||
"max": 100
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "100 * (1 - avg(rate(node_cpu_seconds_total{job=\"node\",mode=\"idle\"}[2m])))",
|
||||
"legendFormat": "CPU busy %",
|
||||
"range": true,
|
||||
"instant": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"type": "timeseries",
|
||||
"title": "Available host memory",
|
||||
"description": "MemAvailable in bytes (IEC units): the kernel's estimate of memory that can be given to applications without swapping, not merely unused RAM. Whole droplet; swap is not included.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 8,
|
||||
"y": 0,
|
||||
"w": 8,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"lineInterpolation": "linear",
|
||||
"thresholdsStyle": {
|
||||
"mode": "line+area"
|
||||
}
|
||||
},
|
||||
"unit": "bytes",
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "red",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "orange",
|
||||
"value": 67108864
|
||||
},
|
||||
{
|
||||
"color": "green",
|
||||
"value": 134217728
|
||||
}
|
||||
]
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "node_memory_MemAvailable_bytes{job=\"node\"}",
|
||||
"legendFormat": "Available",
|
||||
"range": true,
|
||||
"instant": false
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "node_memory_MemTotal_bytes{job=\"node\"}",
|
||||
"legendFormat": "Total RAM",
|
||||
"range": true,
|
||||
"instant": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"type": "timeseries",
|
||||
"title": "Root filesystem free space",
|
||||
"description": "Available bytes divided by size bytes for the host root filesystem (mountpoint /, ext4, /dev/vda1 seen through the /host mount), as a percent. The 15% line is the capacity alert threshold.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 16,
|
||||
"y": 0,
|
||||
"w": 8,
|
||||
"h": 8
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"lineInterpolation": "linear",
|
||||
"thresholdsStyle": {
|
||||
"mode": "line+area"
|
||||
}
|
||||
},
|
||||
"unit": "percent",
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "red",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "orange",
|
||||
"value": 15
|
||||
},
|
||||
{
|
||||
"color": "green",
|
||||
"value": 25
|
||||
}
|
||||
]
|
||||
},
|
||||
"min": 0,
|
||||
"max": 100
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "100 * node_filesystem_avail_bytes{job=\"node\",mountpoint=\"/\",fstype=\"ext4\"} / node_filesystem_size_bytes{job=\"node\",mountpoint=\"/\",fstype=\"ext4\"}",
|
||||
"legendFormat": "/ free %",
|
||||
"range": true,
|
||||
"instant": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"type": "timeseries",
|
||||
"title": "Gitea HTTPS availability",
|
||||
"description": "probe_success for https://git.pollefeys.dev/user/login: 1 when DNS, TLS, and an HTTP 200 login page all succeed within 10 s through Caddy, 0 otherwise. A gap means no probe result was collected (unknown, not up).",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 8,
|
||||
"w": 8,
|
||||
"h": 7
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"lineInterpolation": "stepAfter",
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"unit": "none",
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"min": 0,
|
||||
"max": 1,
|
||||
"mappings": [
|
||||
{
|
||||
"type": "value",
|
||||
"options": {
|
||||
"0": {
|
||||
"text": "DOWN",
|
||||
"color": "red"
|
||||
},
|
||||
"1": {
|
||||
"text": "UP",
|
||||
"color": "green"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "probe_success{job=\"https\",instance=\"https://git.pollefeys.dev/user/login\"}",
|
||||
"legendFormat": "Gitea",
|
||||
"range": true,
|
||||
"instant": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"type": "timeseries",
|
||||
"title": "Jenkins HTTPS availability",
|
||||
"description": "probe_success for https://ci.pollefeys.dev/login: 1 when DNS, TLS, and an HTTP 200 login page all succeed within 10 s through Caddy, 0 otherwise. A gap means no probe result was collected (unknown, not up).",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 8,
|
||||
"y": 8,
|
||||
"w": 8,
|
||||
"h": 7
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"lineInterpolation": "stepAfter",
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"unit": "none",
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"min": 0,
|
||||
"max": 1,
|
||||
"mappings": [
|
||||
{
|
||||
"type": "value",
|
||||
"options": {
|
||||
"0": {
|
||||
"text": "DOWN",
|
||||
"color": "red"
|
||||
},
|
||||
"1": {
|
||||
"text": "UP",
|
||||
"color": "green"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "probe_success{job=\"https\",instance=\"https://ci.pollefeys.dev/login\"}",
|
||||
"legendFormat": "Jenkins",
|
||||
"range": true,
|
||||
"instant": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"type": "timeseries",
|
||||
"title": "HTTPS probe duration",
|
||||
"description": "probe_duration_seconds for each login URL: total time of the probe, including DNS, TCP, TLS, and the HTTP response, as measured from the droplet itself.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 16,
|
||||
"y": 8,
|
||||
"w": 8,
|
||||
"h": 7
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"lineInterpolation": "linear",
|
||||
"thresholdsStyle": {
|
||||
"mode": "line+area"
|
||||
}
|
||||
},
|
||||
"unit": "s",
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "orange",
|
||||
"value": 2
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "probe_duration_seconds{job=\"https\"}",
|
||||
"legendFormat": "{{instance}}",
|
||||
"range": true,
|
||||
"instant": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"type": "stat",
|
||||
"title": "Scrape health (up)",
|
||||
"description": "Prometheus's own record of whether each scrape target answered: 1 = scraped, 0 = scrape failed. For the https job this says the probe ran, not that the site is up.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 15,
|
||||
"w": 24,
|
||||
"h": 4
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"mappings": [
|
||||
{
|
||||
"type": "value",
|
||||
"options": {
|
||||
"0": {
|
||||
"text": "DOWN",
|
||||
"color": "red"
|
||||
},
|
||||
"1": {
|
||||
"text": "UP",
|
||||
"color": "green"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"unit": "none",
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "red",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "green",
|
||||
"value": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"colorMode": "background",
|
||||
"graphMode": "none",
|
||||
"textMode": "value_and_name",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"justifyMode": "auto",
|
||||
"orientation": "auto"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "up",
|
||||
"legendFormat": "{{job}} {{instance}}",
|
||||
"range": false,
|
||||
"instant": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
apiVersion: 1
|
||||
|
||||
# Grafana expands $NAME from its environment in provisioning files, so the
|
||||
# Discord webhook comes from grafana.secrets.env and never appears in Git.
|
||||
# Templates below use .Labels instead of $labels for the same reason.
|
||||
contactPoints:
|
||||
- orgId: 1
|
||||
name: team-alerts
|
||||
receivers:
|
||||
- uid: team-alerts-discord
|
||||
type: discord
|
||||
settings:
|
||||
url: $DISCORD_WEBHOOK_URL
|
||||
use_discord_username: false
|
||||
disableResolveMessage: false
|
||||
|
||||
# Every alert goes to team-alerts; one notification per rule and instance.
|
||||
policies:
|
||||
- orgId: 1
|
||||
receiver: team-alerts
|
||||
group_by: [grafana_folder, alertname, instance]
|
||||
group_wait: 30s
|
||||
group_interval: 1m
|
||||
repeat_interval: 4h
|
||||
|
||||
groups:
|
||||
- orgId: 1
|
||||
name: https-availability
|
||||
folder: Seat-Back Trivia SRE
|
||||
interval: 30s
|
||||
rules:
|
||||
- uid: https-unavailable
|
||||
title: HTTPS service unavailable
|
||||
condition: C
|
||||
data:
|
||||
- refId: A
|
||||
relativeTimeRange: {from: 300, to: 0}
|
||||
datasourceUid: prometheus
|
||||
model:
|
||||
refId: A
|
||||
expr: probe_success{job="https"}
|
||||
instant: true
|
||||
range: false
|
||||
- refId: C
|
||||
datasourceUid: __expr__
|
||||
model:
|
||||
refId: C
|
||||
type: threshold
|
||||
expression: A
|
||||
conditions:
|
||||
- evaluator: {type: lt, params: [1]}
|
||||
# A missing probe series or a failed query is a monitoring failure,
|
||||
# not health: both fire the alert.
|
||||
noDataState: Alerting
|
||||
execErrState: Alerting
|
||||
for: 1m
|
||||
labels:
|
||||
severity: critical
|
||||
owner: CP
|
||||
annotations:
|
||||
summary: "{{ .Labels.instance }} has failed its HTTPS probe for at least 1 minute."
|
||||
description: "probe_success is 0, or the probe series is missing. Check the service container, Caddy, DNS, and the TLS certificate."
|
||||
runbook_url: https://git.pollefeys.dev/SeatBackTrivia/devops-manual/src/branch/master/devopsMonitoring.tex
|
||||
|
||||
- orgId: 1
|
||||
name: host-capacity
|
||||
folder: Seat-Back Trivia SRE
|
||||
interval: 1m
|
||||
rules:
|
||||
- uid: root-disk-low
|
||||
title: Root filesystem below 15% free
|
||||
condition: C
|
||||
data:
|
||||
- refId: A
|
||||
relativeTimeRange: {from: 600, to: 0}
|
||||
datasourceUid: prometheus
|
||||
model:
|
||||
refId: A
|
||||
expr: node_filesystem_avail_bytes{job="node",mountpoint="/",fstype="ext4"} / node_filesystem_size_bytes{job="node",mountpoint="/",fstype="ext4"}
|
||||
instant: true
|
||||
range: false
|
||||
- refId: C
|
||||
datasourceUid: __expr__
|
||||
model:
|
||||
refId: C
|
||||
type: threshold
|
||||
expression: A
|
||||
conditions:
|
||||
# Free-space threshold as a fraction. The capacity test raises
|
||||
# it temporarily; the final value is 0.15.
|
||||
- evaluator: {type: lt, params: [0.15]}
|
||||
noDataState: Alerting
|
||||
execErrState: Alerting
|
||||
for: 5m
|
||||
labels:
|
||||
severity: warning
|
||||
owner: NA
|
||||
annotations:
|
||||
summary: "Root filesystem on ssw-590 has had less than 15% free space for 5 minutes."
|
||||
description: "Check docker system df and du -sh /var/log; remove build cache and unused images, never named volumes."
|
||||
runbook_url: https://git.pollefeys.dev/SeatBackTrivia/devops-manual/src/branch/master/devopsMonitoring.tex
|
||||
@@ -0,0 +1,11 @@
|
||||
apiVersion: 1
|
||||
|
||||
# The dashboard JSON in Git is the source of truth; edits in the UI are refused.
|
||||
providers:
|
||||
- name: seat-back-trivia
|
||||
folder: Seat-Back Trivia SRE
|
||||
type: file
|
||||
disableDeletion: true
|
||||
allowUiUpdates: false
|
||||
options:
|
||||
path: /etc/grafana/dashboards
|
||||
@@ -0,0 +1,14 @@
|
||||
apiVersion: 1
|
||||
|
||||
# Grafana reaches Prometheus by its service name on the monitoring network.
|
||||
# localhost would mean the Grafana container itself.
|
||||
datasources:
|
||||
- name: Prometheus
|
||||
uid: prometheus
|
||||
type: prometheus
|
||||
access: proxy
|
||||
url: http://prometheus:9090
|
||||
isDefault: true
|
||||
editable: false
|
||||
jsonData:
|
||||
timeInterval: 30s
|
||||
@@ -0,0 +1,37 @@
|
||||
# Scrape and rule timing: every 30 s. Targets are container names on the
|
||||
# private monitoring network; none of these ports is published.
|
||||
global:
|
||||
scrape_interval: 30s
|
||||
evaluation_interval: 30s
|
||||
|
||||
scrape_configs:
|
||||
- job_name: prometheus
|
||||
static_configs:
|
||||
- targets: ["prometheus:9090"]
|
||||
|
||||
- job_name: node
|
||||
static_configs:
|
||||
- targets: ["node-exporter:9100"]
|
||||
|
||||
# Blackbox Exporter's own metrics, separate from the probes it runs.
|
||||
- job_name: blackbox
|
||||
static_configs:
|
||||
- targets: ["blackbox-exporter:9115"]
|
||||
|
||||
# HTTPS login-page probes through Caddy. Each URL becomes the probe target
|
||||
# and the instance label; the scrape itself goes to blackbox-exporter:9115.
|
||||
- job_name: https
|
||||
metrics_path: /probe
|
||||
params:
|
||||
module: [http_2xx]
|
||||
static_configs:
|
||||
- targets:
|
||||
- https://git.pollefeys.dev/user/login
|
||||
- https://ci.pollefeys.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
|
||||
Reference in New Issue
Block a user