|
| 1 | +groups: |
| 2 | + - name: host |
| 3 | + rules: |
| 4 | + - alert: InstanceDown |
| 5 | + expr: up == 0 |
| 6 | + for: 1m |
| 7 | + labels: |
| 8 | + severity: critical |
| 9 | + annotations: |
| 10 | + summary: "Scrape target down: {{ $labels.job }}" |
| 11 | + description: "{{ $labels.job }} ({{ $labels.instance }}) has been unreachable for more than 1 minute." |
| 12 | + |
| 13 | + - alert: HighCPU |
| 14 | + expr: 100 - (avg(rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) > 80 |
| 15 | + for: 5m |
| 16 | + labels: |
| 17 | + severity: warning |
| 18 | + annotations: |
| 19 | + summary: "Host CPU above 80%" |
| 20 | + description: "CPU usage is {{ $value | printf \"%.1f\" }}% (threshold: 80%)." |
| 21 | + |
| 22 | + - alert: HighCPUCritical |
| 23 | + expr: 100 - (avg(rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) > 95 |
| 24 | + for: 2m |
| 25 | + labels: |
| 26 | + severity: critical |
| 27 | + annotations: |
| 28 | + summary: "Host CPU above 95%" |
| 29 | + description: "CPU usage is {{ $value | printf \"%.1f\" }}% — host may be unresponsive." |
| 30 | + |
| 31 | + - alert: HighMemory |
| 32 | + expr: (1 - node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes) * 100 > 85 |
| 33 | + for: 5m |
| 34 | + labels: |
| 35 | + severity: warning |
| 36 | + annotations: |
| 37 | + summary: "Host memory above 85%" |
| 38 | + description: "Memory usage is {{ $value | printf \"%.1f\" }}% (threshold: 85%)." |
| 39 | + |
| 40 | + - alert: DiskAlmostFull |
| 41 | + expr: (1 - node_filesystem_avail_bytes{mountpoint="/",fstype!="tmpfs"} / node_filesystem_size_bytes{mountpoint="/",fstype!="tmpfs"}) * 100 > 85 |
| 42 | + for: 5m |
| 43 | + labels: |
| 44 | + severity: warning |
| 45 | + annotations: |
| 46 | + summary: "Disk (/) above 85%" |
| 47 | + description: "Disk usage is {{ $value | printf \"%.1f\" }}%. Clean up soon." |
| 48 | + |
| 49 | + - alert: DiskCritical |
| 50 | + expr: (1 - node_filesystem_avail_bytes{mountpoint="/",fstype!="tmpfs"} / node_filesystem_size_bytes{mountpoint="/",fstype!="tmpfs"}) * 100 > 95 |
| 51 | + for: 1m |
| 52 | + labels: |
| 53 | + severity: critical |
| 54 | + annotations: |
| 55 | + summary: "Disk (/) above 95% — critical" |
| 56 | + description: "Disk usage is {{ $value | printf \"%.1f\" }}%. Writes may fail." |
| 57 | + |
| 58 | + - alert: HighIOWait |
| 59 | + expr: avg(rate(node_cpu_seconds_total{mode="iowait"}[5m])) * 100 > 20 |
| 60 | + for: 5m |
| 61 | + labels: |
| 62 | + severity: warning |
| 63 | + annotations: |
| 64 | + summary: "High I/O wait" |
| 65 | + description: "IOWait is {{ $value | printf \"%.1f\" }}% — storage may be saturated." |
| 66 | + |
| 67 | + - name: containers |
| 68 | + rules: |
| 69 | + - alert: APIContainerDown |
| 70 | + expr: absent(container_last_seen{name=~".*x8ogsg0s4gws0840w8kksokk-api.*"}) |
| 71 | + for: 2m |
| 72 | + labels: |
| 73 | + severity: critical |
| 74 | + annotations: |
| 75 | + summary: "ProStaff API container is down" |
| 76 | + description: "The API container has not been seen for more than 2 minutes." |
| 77 | + |
| 78 | + - alert: SidekiqContainerDown |
| 79 | + expr: absent(container_last_seen{name=~".*x8ogsg0s4gws0840w8kksokk-sidekiq.*"}) |
| 80 | + for: 2m |
| 81 | + labels: |
| 82 | + severity: critical |
| 83 | + annotations: |
| 84 | + summary: "Sidekiq container is down" |
| 85 | + description: "The Sidekiq container has not been seen for more than 2 minutes." |
| 86 | + |
| 87 | + - alert: PostgresContainerDown |
| 88 | + expr: absent(container_last_seen{name=~".*x8ogsg0s4gws0840w8kksokk-postgres.*"}) |
| 89 | + for: 2m |
| 90 | + labels: |
| 91 | + severity: critical |
| 92 | + annotations: |
| 93 | + summary: "Postgres container is down" |
| 94 | + description: "The Postgres container has not been seen for more than 2 minutes." |
| 95 | + |
| 96 | + - alert: RedisContainerDown |
| 97 | + expr: absent(container_last_seen{name=~".*x8ogsg0s4gws0840w8kksokk-redis.*"}) |
| 98 | + for: 2m |
| 99 | + labels: |
| 100 | + severity: critical |
| 101 | + annotations: |
| 102 | + summary: "Redis container is down" |
| 103 | + description: "The Redis container has not been seen for more than 2 minutes. ActionCable and Sidekiq will fail." |
| 104 | + |
| 105 | + - alert: ContainerHighCPU |
| 106 | + expr: sum by (name) (rate(container_cpu_usage_seconds_total{name!="",name!~".*pause.*"}[5m])) * 100 > 80 |
| 107 | + for: 5m |
| 108 | + labels: |
| 109 | + severity: warning |
| 110 | + annotations: |
| 111 | + summary: "Container CPU above 80%: {{ $labels.name }}" |
| 112 | + description: "{{ $labels.name }} CPU is {{ $value | printf \"%.1f\" }}%." |
| 113 | + |
| 114 | + - alert: ContainerRestarting |
| 115 | + expr: increase(container_start_time_seconds{name!="",name!~".*pause.*"}[30m]) > 2 |
| 116 | + for: 0m |
| 117 | + labels: |
| 118 | + severity: warning |
| 119 | + annotations: |
| 120 | + summary: "Container restarting: {{ $labels.name }}" |
| 121 | + description: "{{ $labels.name }} has restarted {{ $value | printf \"%.0f\" }} times in the last 30 minutes." |
0 commit comments