con un clic
alerting-rules
Write Prometheus alerting rules and configure Alertmanager routing for home lab notifications.
Menú
Write Prometheus alerting rules and configure Alertmanager routing for home lab notifications.
Write and run Ansible playbooks for multi-node home lab provisioning and configuration management.
Configure and manage restic backups including scheduling, verification, and disaster recovery.
Let's Encrypt, self-signed certs, renewal automation, NPM cert integration
Full Pi disaster recovery -- backup verification, restore workflows, SD card imaging, and migration checklists
Manage AdGuard Home DNS filtering, blocklists, local DNS records, and query log analysis.
Manage multi-file Docker Compose deployments on a Raspberry Pi home lab server.
| name | alerting-rules |
| description | Write Prometheus alerting rules and configure Alertmanager routing for home lab notifications. |
| tools | ["homelab_alertList","homelab_prometheusQuery","homelab_ntfySend"] |
| standards-version | 1.10.0 |
Write, test, and manage Prometheus alerting rules and Alertmanager routing configuration on a Raspberry Pi home lab. Covers rule syntax, alert grouping, receiver setup, inhibition rules, and integration with ntfy for push notifications.
homelab_sshTest)Optional:
homelab_sshTest.homelab_serviceHealth for Prometheus and
Alertmanager containers.homelab_prometheusQueryfor duration and labelshomelab_prometheusQuery on ALERTSalertmanager.yml to add receivers and routeshomelab_alertList to check current alert stateshomelab_prometheusQuery with the alert expression to verify it evaluates truehomelab_serviceLogsService endpoints:
http://pi:9090 -- rules UI at /-/ruleshttp://pi:9093 -- alerts UI and APIhttp://pi:8080 -- push notification serverConfig file locations:
/opt/homelab/docker/monitoring/
prometheus/prometheus.yml # Global config with rule_files reference
prometheus/rules/alerts.yml # Alerting rule definitions
alertmanager/alertmanager.yml # Receiver and route configuration
Alert rule syntax:
groups:
- name: homelab
rules:
- alert: HighCPUUsage
expr: 100 - (avg by(instance) (irate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) > 80
for: 5m
labels:
severity: warning
annotations:
summary: "High CPU usage on {{ $labels.instance }}"
description: "CPU usage is above 80% for 5 minutes (current: {{ $value | printf \"%.1f\" }}%)"
Alertmanager ntfy receiver:
receivers:
- name: ntfy
webhook_configs:
- url: http://ntfy:8080/homelab-alerts
send_resolved: true
User: "Set up an alert for when disk usage goes above 85%"
Assistant actions:
homelab_prometheusQuery with disk usage expressionResponse:
Add this rule to
/opt/homelab/docker/monitoring/prometheus/rules/alerts.yml:- alert: DiskSpaceLow expr: (1 - node_filesystem_avail_bytes{mountpoint="/"} / node_filesystem_size_bytes{mountpoint="/"}) * 100 > 85 for: 10m labels: severity: warning annotations: summary: "Disk usage above 85% on {{ $labels.instance }}"After adding, reload Prometheus config. The alert will fire after disk stays above 85% for 10 minutes.
User: "Why am I not getting notifications for my alerts?"
Assistant actions:
homelab_alertList to see current alertshomelab_serviceLogs for Alertmanager| Tool | Purpose |
|---|---|
homelab_sshTest | Validate connectivity before operations |
homelab_prometheusQuery | Verify metrics exist and test alert expressions |
homelab_alertList | Check current Alertmanager alert states |
homelab_serviceHealth | Check Prometheus and Alertmanager health |
homelab_serviceLogs | Debug alert delivery issues |
homelab_serviceRestart | Restart Prometheus/Alertmanager after config changes |
for duration too short -- a for: 0s alert fires on every evaluation and
can flood notifications. Use at least for: 5m for most conditions.POST /-/reload for config
changes. A full restart causes a brief metrics gap. Prefer reload when possible.send_resolved: true sends a follow-up when the alert
clears. This is helpful but doubles notification volume.avg by, sum by) to reduce.promtool check rules alerts.yml to validate syntax before
reloading. Bad YAML will prevent Prometheus from starting.