alert-rules.yaml (3452B)
1 groups: 2 # ── Generic scrape target availability ───────────────────────────────────── 3 - name: targets 4 rules: 5 - alert: TargetDown 6 expr: up == 0 7 for: 2m 8 labels: 9 severity: critical 10 annotations: 11 summary: "Target {{ $labels.job }}/{{ $labels.instance }} is down" 12 description: > 13 Scrape target {{ $labels.instance }} (job: {{ $labels.job }}) has been 14 unreachable for more than 2 minutes. 15 16 # ── Host-level metrics (node_exporter) ───────────────────────────────────── 17 - name: node 18 rules: 19 - alert: HighCPULoad 20 expr: 100 - (avg by(instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) > 90 21 for: 10m 22 labels: 23 severity: warning 24 annotations: 25 summary: "High CPU load: {{ $value | printf \"%.0f\" }}%" 26 description: "CPU usage has been above 90% for more than 10 minutes." 27 28 - alert: HighMemoryUsage 29 expr: (1 - node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes) * 100 > 90 30 for: 5m 31 labels: 32 severity: warning 33 annotations: 34 summary: "High memory usage: {{ $value | printf \"%.0f\" }}%" 35 description: "Available memory has been below 10% for more than 5 minutes." 36 37 - alert: HighDiskUsage 38 expr: > 39 (1 - node_filesystem_avail_bytes{fstype!~"tmpfs|fuse.lxcfs|squashfs|ramfs|overlay"} 40 / node_filesystem_size_bytes) * 100 > 85 41 for: 5m 42 labels: 43 severity: warning 44 annotations: 45 summary: "High disk usage on {{ $labels.mountpoint }}: {{ $value | printf \"%.0f\" }}%" 46 description: > 47 Disk usage on {{ $labels.mountpoint }} ({{ $labels.device }}) has been 48 above 85% for more than 5 minutes. 49 50 - alert: DiskWillFillSoon 51 expr: > 52 predict_linear( 53 node_filesystem_avail_bytes{fstype!~"tmpfs|fuse.lxcfs|squashfs|ramfs|overlay"}[6h], 54 4 * 3600 55 ) < 0 56 for: 30m 57 labels: 58 severity: warning 59 annotations: 60 summary: "Disk {{ $labels.mountpoint }} predicted to fill within 4 hours" 61 description: > 62 Based on the last 6 hours of growth, {{ $labels.mountpoint }} will run 63 out of space within 4 hours. 64 65 - alert: HighSystemLoad 66 expr: node_load15 / count without(cpu, mode) (node_cpu_seconds_total{mode="idle"}) > 2 67 for: 15m 68 labels: 69 severity: warning 70 annotations: 71 summary: "High 15-minute load average: {{ $value | printf \"%.2f\" }}" 72 description: "The 15-minute load average per CPU core has been above 2 for 15 minutes." 73 74 # ── Systemd unit health (systemd_exporter) ───────────────────────────────── 75 - name: systemd 76 rules: 77 - alert: SystemdUnitFailed 78 expr: node_systemd_unit_state{state="failed"} == 1 79 for: 5m 80 labels: 81 severity: critical 82 annotations: 83 summary: "Systemd unit {{ $labels.name }} failed" 84 description: > 85 The systemd unit {{ $labels.name }} has been in a failed state 86 for more than 5 minutes.