|
| 1 | +groups: |
| 2 | + - name: infrastructure |
| 3 | + rules: |
| 4 | + - alert: ServiceDown |
| 5 | + expr: up == 0 |
| 6 | + for: 1m |
| 7 | + labels: |
| 8 | + severity: critical |
| 9 | + annotations: |
| 10 | + summary: "Service {{ $labels.job }} is down" |
| 11 | + description: "{{ $labels.job }} has been unreachable for more than 1 minute." |
| 12 | + runbook: "https://github.com/Mystery-CLI/StellarEscrow/blob/main/Troubleshooting.md" |
| 13 | + |
| 14 | + - alert: HighCPUUsage |
| 15 | + expr: 100 - (avg by(instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) > 85 |
| 16 | + for: 5m |
| 17 | + labels: |
| 18 | + severity: warning |
| 19 | + annotations: |
| 20 | + summary: "High CPU usage on {{ $labels.instance }}" |
| 21 | + description: "CPU usage is {{ $value | humanize }}% (threshold: 85%)." |
| 22 | + |
| 23 | + - alert: CriticalCPUUsage |
| 24 | + expr: 100 - (avg by(instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) > 95 |
| 25 | + for: 2m |
| 26 | + labels: |
| 27 | + severity: critical |
| 28 | + annotations: |
| 29 | + summary: "Critical CPU usage on {{ $labels.instance }}" |
| 30 | + description: "CPU usage is {{ $value | humanize }}% (threshold: 95%)." |
| 31 | + |
| 32 | + - alert: HighMemoryUsage |
| 33 | + expr: (1 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)) * 100 > 85 |
| 34 | + for: 5m |
| 35 | + labels: |
| 36 | + severity: warning |
| 37 | + annotations: |
| 38 | + summary: "High memory usage on {{ $labels.instance }}" |
| 39 | + description: "Memory usage is {{ $value | humanize }}% (threshold: 85%)." |
| 40 | + |
| 41 | + - alert: CriticalMemoryUsage |
| 42 | + expr: (1 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)) * 100 > 95 |
| 43 | + for: 2m |
| 44 | + labels: |
| 45 | + severity: critical |
| 46 | + annotations: |
| 47 | + summary: "Critical memory usage on {{ $labels.instance }}" |
| 48 | + description: "Memory usage is {{ $value | humanize }}% (threshold: 95%)." |
| 49 | + |
| 50 | + - alert: DiskSpaceWarning |
| 51 | + expr: (1 - (node_filesystem_avail_bytes{fstype!~"tmpfs|overlay"} / node_filesystem_size_bytes{fstype!~"tmpfs|overlay"})) * 100 > 80 |
| 52 | + for: 5m |
| 53 | + labels: |
| 54 | + severity: warning |
| 55 | + annotations: |
| 56 | + summary: "Disk space warning on {{ $labels.instance }} ({{ $labels.mountpoint }})" |
| 57 | + description: "Disk usage is {{ $value | humanize }}% (threshold: 80%)." |
| 58 | + |
| 59 | + - alert: DiskSpaceCritical |
| 60 | + expr: (1 - (node_filesystem_avail_bytes{fstype!~"tmpfs|overlay"} / node_filesystem_size_bytes{fstype!~"tmpfs|overlay"})) * 100 > 90 |
| 61 | + for: 2m |
| 62 | + labels: |
| 63 | + severity: critical |
| 64 | + annotations: |
| 65 | + summary: "Critical disk space on {{ $labels.instance }} ({{ $labels.mountpoint }})" |
| 66 | + description: "Disk usage is {{ $value | humanize }}% (threshold: 90%)." |
| 67 | + |
| 68 | + - alert: PostgresDown |
| 69 | + expr: pg_up == 0 |
| 70 | + for: 1m |
| 71 | + labels: |
| 72 | + severity: critical |
| 73 | + annotations: |
| 74 | + summary: "PostgreSQL is down" |
| 75 | + description: "PostgreSQL exporter reports the database is unreachable." |
| 76 | + runbook: "https://github.com/Mystery-CLI/StellarEscrow/blob/main/Troubleshooting.md#rb-001-postgresql-failure" |
| 77 | + |
| 78 | + - alert: PostgresHighConnections |
| 79 | + expr: pg_stat_activity_count / pg_settings_max_connections > 0.85 |
| 80 | + for: 3m |
| 81 | + labels: |
| 82 | + severity: warning |
| 83 | + annotations: |
| 84 | + summary: "PostgreSQL connection pool near limit" |
| 85 | + description: "{{ $value | humanizePercentage }} of max connections in use." |
| 86 | + |
| 87 | + - alert: RedisDown |
| 88 | + expr: redis_up == 0 |
| 89 | + for: 1m |
| 90 | + labels: |
| 91 | + severity: high |
| 92 | + annotations: |
| 93 | + summary: "Redis is down" |
| 94 | + description: "Redis exporter reports the cache is unreachable." |
| 95 | + runbook: "https://github.com/Mystery-CLI/StellarEscrow/blob/main/Troubleshooting.md#rb-005-redis-cache-failure" |
| 96 | + |
| 97 | + - alert: RedisLowHitRate |
| 98 | + expr: rate(redis_keyspace_hits_total[5m]) / (rate(redis_keyspace_hits_total[5m]) + rate(redis_keyspace_misses_total[5m])) < 0.7 |
| 99 | + for: 10m |
| 100 | + labels: |
| 101 | + severity: warning |
| 102 | + annotations: |
| 103 | + summary: "Redis cache hit rate below 70%" |
| 104 | + description: "Cache hit rate is {{ $value | humanizePercentage }}." |
0 commit comments