| 1 | # you can disable an alarm notification by setting the 'to' line to: silent |
| 2 | |
| 3 | # --- Availability --- |
| 4 | |
| 5 | template: am_postgres_flexible_availability |
| 6 | on: azure_monitor.postgres_flexible.availability |
| 7 | class: Availability |
| 8 | type: Database |
| 9 | component: Azure PostgreSQL Flexible |
| 10 | lookup: average -5m unaligned of maximum |
| 11 | units: state |
| 12 | every: 1m |
| 13 | crit: $this < 1 |
| 14 | delay: down 5m multiplier 1.5 max 1h |
| 15 | summary: PostgreSQL Flexible Server down on ${label:resource_name} |
| 16 | info: Database is not alive on Azure PostgreSQL Flexible Server ${label:resource_name} \ |
| 17 | in ${label:resource_group} (${label:region}) |
| 18 | to: dba |
| 19 | |
| 20 | # --- Utilization --- |
| 21 | |
| 22 | template: am_postgres_flexible_cpu |
| 23 | on: azure_monitor.postgres_flexible.cpu |
| 24 | class: Utilization |
| 25 | type: Database |
| 26 | component: Azure PostgreSQL Flexible |
| 27 | lookup: average -5m unaligned of average |
| 28 | units: percentage |
| 29 | every: 1m |
| 30 | warn: $this > (($status >= $WARNING) ? (75) : (85)) |
| 31 | crit: $this > (($status == $CRITICAL) ? (85) : (95)) |
| 32 | delay: down 5m multiplier 1.5 max 1h |
| 33 | summary: PostgreSQL Flexible CPU on ${label:resource_name} |
| 34 | info: Average CPU utilization on Azure PostgreSQL Flexible Server ${label:resource_name} \ |
| 35 | in ${label:resource_group} (${label:region}) |
| 36 | to: dba |
| 37 | |
| 38 | template: am_postgres_flexible_memory |
| 39 | on: azure_monitor.postgres_flexible.memory |
| 40 | class: Utilization |
| 41 | type: Database |
| 42 | component: Azure PostgreSQL Flexible |
| 43 | lookup: average -5m unaligned of average |
| 44 | units: percentage |
| 45 | every: 1m |
| 46 | warn: $this > (($status >= $WARNING) ? (80) : (90)) |
| 47 | crit: $this > (($status == $CRITICAL) ? (90) : (95)) |
| 48 | delay: down 5m multiplier 1.5 max 1h |
| 49 | summary: PostgreSQL Flexible memory on ${label:resource_name} |
| 50 | info: Average memory utilization on Azure PostgreSQL Flexible Server ${label:resource_name} \ |
| 51 | in ${label:resource_group} (${label:region}) |
| 52 | to: dba |
| 53 | |
| 54 | # --- Storage --- |
| 55 | |
| 56 | template: am_postgres_flexible_storage_utilization |
| 57 | on: azure_monitor.postgres_flexible.storage_utilization |
| 58 | class: Utilization |
| 59 | type: Database |
| 60 | component: Azure PostgreSQL Flexible |
| 61 | lookup: average -5m unaligned of average |
| 62 | units: percentage |
| 63 | every: 1m |
| 64 | warn: $this > (($status >= $WARNING) ? (75) : (85)) |
| 65 | crit: $this > (($status == $CRITICAL) ? (85) : (95)) |
| 66 | delay: down 5m multiplier 1.5 max 1h |
| 67 | summary: PostgreSQL Flexible storage on ${label:resource_name} |
| 68 | info: Storage utilization on Azure PostgreSQL Flexible Server ${label:resource_name} \ |
| 69 | in ${label:resource_group} (${label:region}). \ |
| 70 | Running out of storage causes the server to become read-only |
| 71 | to: dba |
| 72 | |
| 73 | # --- I/O --- |
| 74 | |
| 75 | template: am_postgres_flexible_disk_bandwidth_saturation |
| 76 | on: azure_monitor.postgres_flexible.disk_saturation |
| 77 | class: Utilization |
| 78 | type: Database |
| 79 | component: Azure PostgreSQL Flexible |
| 80 | lookup: average -5m unaligned of bandwidth |
| 81 | units: percentage |
| 82 | every: 1m |
| 83 | warn: $this > (($status >= $WARNING) ? (75) : (85)) |
| 84 | crit: $this > (($status == $CRITICAL) ? (85) : (95)) |
| 85 | delay: down 5m multiplier 1.5 max 1h |
| 86 | summary: PostgreSQL Flexible disk bandwidth saturation on ${label:resource_name} |
| 87 | info: Disk bandwidth consumed percentage on Azure PostgreSQL Flexible Server ${label:resource_name} \ |
| 88 | in ${label:resource_group} (${label:region}). \ |
| 89 | Sustained high values indicate I/O throttling |
| 90 | to: dba |
| 91 | |
| 92 | template: am_postgres_flexible_disk_iops_saturation |
| 93 | on: azure_monitor.postgres_flexible.disk_saturation |
| 94 | class: Utilization |
| 95 | type: Database |
| 96 | component: Azure PostgreSQL Flexible |
| 97 | lookup: average -5m unaligned of iops |
| 98 | units: percentage |
| 99 | every: 1m |
| 100 | warn: $this > (($status >= $WARNING) ? (75) : (85)) |
| 101 | crit: $this > (($status == $CRITICAL) ? (85) : (95)) |
| 102 | delay: down 5m multiplier 1.5 max 1h |
| 103 | summary: PostgreSQL Flexible disk IOPS saturation on ${label:resource_name} |
| 104 | info: Disk IOPS consumed percentage on Azure PostgreSQL Flexible Server ${label:resource_name} \ |
| 105 | in ${label:resource_group} (${label:region}). \ |
| 106 | Sustained high values indicate I/O throttling |
| 107 | to: dba |
| 108 | |
| 109 | template: am_postgres_flexible_disk_queue_depth |
| 110 | on: azure_monitor.postgres_flexible.disk_queue_depth |
| 111 | class: Workload |
| 112 | type: Database |
| 113 | component: Azure PostgreSQL Flexible |
| 114 | lookup: average -5m unaligned of average |
| 115 | units: operations |
| 116 | every: 1m |
| 117 | warn: $this > (($status >= $WARNING) ? (32) : (64)) |
| 118 | crit: $this > (($status == $CRITICAL) ? (64) : (128)) |
| 119 | delay: down 5m multiplier 1.5 max 1h |
| 120 | summary: PostgreSQL Flexible disk queue depth on ${label:resource_name} |
| 121 | info: Disk queue depth on Azure PostgreSQL Flexible Server ${label:resource_name} \ |
| 122 | in ${label:resource_group} (${label:region}). \ |
| 123 | High queue depth indicates I/O subsystem is saturated |
| 124 | to: dba |
| 125 | |
| 126 | # --- Connections --- |
| 127 | |
| 128 | template: am_postgres_flexible_failed_connections |
| 129 | on: azure_monitor.postgres_flexible.connection_rate |
| 130 | class: Errors |
| 131 | type: Database |
| 132 | component: Azure PostgreSQL Flexible |
| 133 | lookup: average -5m unaligned of failed |
| 134 | units: connections/s |
| 135 | every: 1m |
| 136 | warn: $this > (($status >= $WARNING) ? (1) : (5)) |
| 137 | crit: $this > (($status == $CRITICAL) ? (5) : (20)) |
| 138 | delay: down 5m multiplier 1.5 max 1h |
| 139 | summary: PostgreSQL Flexible failed connections on ${label:resource_name} |
| 140 | info: Rate of failed connection attempts on Azure PostgreSQL Flexible Server ${label:resource_name} \ |
| 141 | in ${label:resource_group} (${label:region}). \ |
| 142 | May indicate authentication failures, connection limit exhaustion, or network issues |
| 143 | to: dba |
| 144 | |
| 145 | template: am_postgres_flexible_tcp_connection_backlog |
| 146 | on: azure_monitor.postgres_flexible.tcp_connection_backlog |
| 147 | class: Workload |
| 148 | type: Database |
| 149 | component: Azure PostgreSQL Flexible |
| 150 | lookup: average -5m unaligned of maximum |
| 151 | units: connections |
| 152 | every: 1m |
| 153 | warn: $this != nan AND $this > (($status >= $WARNING) ? (50) : (100)) |
| 154 | crit: $this != nan AND $this > (($status == $CRITICAL) ? (100) : (200)) |
| 155 | delay: down 5m multiplier 1.5 max 1h |
| 156 | summary: PostgreSQL Flexible TCP connection backlog on ${label:resource_name} |
| 157 | info: TCP connection backlog on Azure PostgreSQL Flexible Server ${label:resource_name} \ |
| 158 | in ${label:resource_group} (${label:region}). \ |
| 159 | High backlog indicates the server cannot accept connections fast enough |
| 160 | to: dba |
| 161 | |
| 162 | # --- Transactions --- |
| 163 | |
| 164 | template: am_postgres_flexible_deadlocks |
| 165 | on: azure_monitor.postgres_flexible.deadlocks |
| 166 | class: Errors |
| 167 | type: Database |
| 168 | component: Azure PostgreSQL Flexible |
| 169 | lookup: average -5m unaligned of total |
| 170 | units: deadlocks/s |
| 171 | every: 1m |
| 172 | warn: $this != nan AND $this > (($status >= $WARNING) ? (0) : (1)) |
| 173 | delay: down 5m multiplier 1.5 max 1h |
| 174 | summary: PostgreSQL Flexible deadlocks on ${label:resource_name} |
| 175 | info: Deadlock rate on Azure PostgreSQL Flexible Server ${label:resource_name} \ |
| 176 | in ${label:resource_group} (${label:region}). \ |
| 177 | Deadlocks indicate conflicting lock acquisition patterns in concurrent transactions |
| 178 | to: dba |
| 179 | |
| 180 | template: am_postgres_flexible_rollback_ratio |
| 181 | on: azure_monitor.postgres_flexible.transactions |
| 182 | class: Errors |
| 183 | type: Database |
| 184 | component: Azure PostgreSQL Flexible |
| 185 | lookup: sum -5m unaligned of committed,rolled_back |
| 186 | calc: ($this > 100) ? ($rolled_back * 100 / $this) : (0) |
| 187 | units: % |
| 188 | every: 1m |
| 189 | warn: $this != nan AND $this > (($status >= $WARNING) ? (3) : (5)) |
| 190 | crit: $this != nan AND $this > (($status == $CRITICAL) ? (10) : (20)) |
| 191 | delay: down 5m multiplier 1.5 max 1h |
| 192 | summary: PostgreSQL Flexible rollback ratio on ${label:resource_name} |
| 193 | info: Percentage of rolled back transactions on Azure PostgreSQL Flexible Server ${label:resource_name} \ |
| 194 | in ${label:resource_group} (${label:region}). \ |
| 195 | High rollback rates indicate application errors or excessive contention |
| 196 | to: dba |
| 197 | |
| 198 | # --- Latency / Long Running --- |
| 199 | |
| 200 | template: am_postgres_flexible_longest_query |
| 201 | on: azure_monitor.postgres_flexible.long_running |
| 202 | class: Latency |
| 203 | type: Database |
| 204 | component: Azure PostgreSQL Flexible |
| 205 | lookup: max -5m unaligned of query |
| 206 | units: seconds |
| 207 | every: 1m |
| 208 | warn: $this != nan AND $this > (($status >= $WARNING) ? (300) : (600)) |
| 209 | crit: $this != nan AND $this > (($status == $CRITICAL) ? (600) : (1800)) |
| 210 | delay: down 5m multiplier 1.5 max 1h |
| 211 | summary: PostgreSQL Flexible long running query on ${label:resource_name} |
| 212 | info: Longest running query duration on Azure PostgreSQL Flexible Server ${label:resource_name} \ |
| 213 | in ${label:resource_group} (${label:region}). \ |
| 214 | Long running queries can hold locks and bloat WAL |
| 215 | to: dba |
| 216 | |
| 217 | template: am_postgres_flexible_longest_transaction |
| 218 | on: azure_monitor.postgres_flexible.long_running |
| 219 | class: Latency |
| 220 | type: Database |
| 221 | component: Azure PostgreSQL Flexible |
| 222 | lookup: max -5m unaligned of transaction |
| 223 | units: seconds |
| 224 | every: 1m |
| 225 | warn: $this != nan AND $this > (($status >= $WARNING) ? (300) : (600)) |
| 226 | crit: $this != nan AND $this > (($status == $CRITICAL) ? (600) : (1800)) |
| 227 | delay: down 5m multiplier 1.5 max 1h |
| 228 | summary: PostgreSQL Flexible long running transaction on ${label:resource_name} |
| 229 | info: Longest running transaction duration on Azure PostgreSQL Flexible Server ${label:resource_name} \ |
| 230 | in ${label:resource_group} (${label:region}). \ |
| 231 | Long running transactions prevent autovacuum from reclaiming dead tuples |
| 232 | to: dba |
| 233 | |
| 234 | # --- Safety (Transaction ID wraparound) --- |
| 235 | |
| 236 | template: am_postgres_flexible_xid_usage |
| 237 | on: azure_monitor.postgres_flexible.xid_usage |
| 238 | class: Utilization |
| 239 | type: Database |
| 240 | component: Azure PostgreSQL Flexible |
| 241 | lookup: average -5m unaligned of max_used |
| 242 | units: transactions |
| 243 | every: 1m |
| 244 | warn: $this > (($status >= $WARNING) ? (500000000) : (1000000000)) |
| 245 | crit: $this > (($status == $CRITICAL) ? (1000000000) : (1500000000)) |
| 246 | delay: down 5m multiplier 1.5 max 1h |
| 247 | summary: PostgreSQL Flexible transaction ID usage on ${label:resource_name} |
| 248 | info: Maximum used transaction IDs on Azure PostgreSQL Flexible Server ${label:resource_name} \ |
| 249 | in ${label:resource_group} (${label:region}). \ |
| 250 | PostgreSQL wraps around at ~2.1 billion XIDs. High values require urgent VACUUM FREEZE |
| 251 | to: dba |
| 252 | |
| 253 | template: am_postgres_flexible_xmin_age |
| 254 | on: azure_monitor.postgres_flexible.xmin_age |
| 255 | class: Utilization |
| 256 | type: Database |
| 257 | component: Azure PostgreSQL Flexible |
| 258 | lookup: average -5m unaligned of maximum |
| 259 | units: transactions |
| 260 | every: 1m |
| 261 | warn: $this != nan AND $this > (($status >= $WARNING) ? (200000000) : (500000000)) |
| 262 | crit: $this != nan AND $this > (($status == $CRITICAL) ? (500000000) : (1000000000)) |
| 263 | delay: down 5m multiplier 1.5 max 1h |
| 264 | summary: PostgreSQL Flexible backend xmin age on ${label:resource_name} |
| 265 | info: Oldest backend xmin age on Azure PostgreSQL Flexible Server ${label:resource_name} \ |
| 266 | in ${label:resource_group} (${label:region}). \ |
| 267 | A large xmin age prevents autovacuum from cleaning dead tuples and increases XID wraparound risk |
| 268 | to: dba |
| 269 | |
| 270 | # --- Bloat --- |
| 271 | |
| 272 | template: am_postgres_flexible_bloat |
| 273 | on: azure_monitor.postgres_flexible.bloat |
| 274 | class: Utilization |
| 275 | type: Database |
| 276 | component: Azure PostgreSQL Flexible |
| 277 | lookup: average -5m unaligned of maximum |
| 278 | units: percentage |
| 279 | every: 1m |
| 280 | warn: $this != nan AND $this > (($status >= $WARNING) ? (40) : (50)) |
| 281 | crit: $this != nan AND $this > (($status == $CRITICAL) ? (60) : (70)) |
| 282 | delay: down 5m multiplier 1.5 max 1h |
| 283 | summary: PostgreSQL Flexible table bloat on ${label:resource_name} |
| 284 | info: Table bloat percentage on Azure PostgreSQL Flexible Server ${label:resource_name} \ |
| 285 | in ${label:resource_group} (${label:region}). \ |
| 286 | High bloat wastes storage and degrades query performance. Consider running VACUUM FULL |
| 287 | to: dba |
| 288 | |
| 289 | # --- Replication --- |
| 290 | |
| 291 | template: am_postgres_flexible_replication_lag |
| 292 | on: azure_monitor.postgres_flexible.replication_lag_time |
| 293 | class: Latency |
| 294 | type: Database |
| 295 | component: Azure PostgreSQL Flexible |
| 296 | lookup: average -5m unaligned of average |
| 297 | units: seconds |
| 298 | every: 1m |
| 299 | warn: $this != nan AND $this > (($status >= $WARNING) ? (10) : (30)) |
| 300 | crit: $this != nan AND $this > (($status == $CRITICAL) ? (30) : (60)) |
| 301 | delay: down 5m multiplier 1.5 max 1h |
| 302 | summary: PostgreSQL Flexible replication lag on ${label:resource_name} |
| 303 | info: Physical replication lag on Azure PostgreSQL Flexible Server ${label:resource_name} \ |
| 304 | in ${label:resource_group} (${label:region}). \ |
| 305 | High lag means replicas serve stale data |
| 306 | to: dba |
| 307 | |
| 308 | # --- CPU Credits (burstable tiers) --- |
| 309 | |
| 310 | template: am_postgres_flexible_cpu_credits_remaining |
| 311 | on: azure_monitor.postgres_flexible.cpu_credits |
| 312 | class: Utilization |
| 313 | type: Database |
| 314 | component: Azure PostgreSQL Flexible |
| 315 | lookup: average -5m unaligned of remaining |
| 316 | units: credits |
| 317 | every: 1m |
| 318 | warn: $this != nan AND $this < (($status >= $WARNING) ? (30) : (20)) |
| 319 | crit: $this != nan AND $this < (($status == $CRITICAL) ? (20) : (10)) |
| 320 | delay: down 5m multiplier 1.5 max 1h |
| 321 | summary: PostgreSQL Flexible CPU credits low on ${label:resource_name} |
| 322 | info: Remaining CPU credits on Azure PostgreSQL Flexible Server ${label:resource_name} \ |
| 323 | in ${label:resource_group} (${label:region}). \ |
| 324 | Only applicable to burstable tiers. When credits are exhausted, CPU is capped at baseline |
| 325 | to: dba |
| 326 | |
| 327 | # --- Temp Files --- |
| 328 | |
| 329 | template: am_postgres_flexible_temp_bytes |
| 330 | on: azure_monitor.postgres_flexible.temp_bytes |
| 331 | class: Workload |
| 332 | type: Database |
| 333 | component: Azure PostgreSQL Flexible |
| 334 | lookup: average -5m unaligned of total |
| 335 | units: bytes/s |
| 336 | every: 1m |
| 337 | warn: $this != nan AND $this > (($status >= $WARNING) ? (52428800) : (104857600)) |
| 338 | crit: $this != nan AND $this > (($status == $CRITICAL) ? (104857600) : (209715200)) |
| 339 | delay: down 5m multiplier 1.5 max 1h |
| 340 | summary: PostgreSQL Flexible temp file I/O on ${label:resource_name} |
| 341 | info: Rate of temporary file bytes written on Azure PostgreSQL Flexible Server ${label:resource_name} \ |
| 342 | in ${label:resource_group} (${label:region}). \ |
| 343 | Excessive temp file usage indicates queries spilling to disk due to insufficient work_mem |
| 344 | to: dba |