critical
2.6.1.PGBouncer down
PGBouncer instance is down on {{ $labels.instance }}
# 1m delay allows a restart without triggering an alert.
# pgbouncer_up also drops to 0 when any SHOW query fails, not only when PGBouncer is unreachable.
- alert: PgbouncerDown
expr: 'pgbouncer_up == 0'
for: 1m
labels:
severity: critical
annotations:
summary: PGBouncer down (instance {{ $labels.instance }})
description: "PGBouncer instance is down on {{ $labels.instance }}\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"critical
2.6.2.PGBouncer flapping
PGBouncer on {{ $labels.instance }} changed state {{ $value | printf "%.0f" }} times in the last 10 minutes.
# Catches a crash-looping service, which the down rule misses because each successful scrape resets its for: timer.
# 4 changes means at least 2 down/up cycles in 10m; one outage followed by a recovery counts only 2.
- alert: PgbouncerFlapping
expr: 'changes(pgbouncer_up[10m]) >= 4'
for: 0m
labels:
severity: critical
annotations:
summary: PGBouncer flapping (instance {{ $labels.instance }})
description: "PGBouncer on {{ $labels.instance }} changed state {{ $value | printf \"%.0f\" }} times in the last 10 minutes.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"critical
2.6.3.PGBouncer max connections
The number of PGBouncer client connections has reached max_client_conn.
- alert: PgbouncerMaxConnections
expr: 'sum(pgbouncer_pools_client_active_connections + pgbouncer_pools_client_waiting_connections) >= pgbouncer_config_max_client_conn'
for: 0m
labels:
severity: critical
annotations:
summary: PGBouncer max connections (instance {{ $labels.instance }})
description: "The number of PGBouncer client connections has reached max_client_conn.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"critical
2.6.4.PGBouncer server connection saturation critical
User connection capacity on {{ $labels.instance }} is above 90% ({{ $value | printf "%.2f" }}%), meaning PGBouncer is about to exhaust its configured max_user_connections limit.
- alert: PgbouncerServerConnectionSaturationCritical
expr: '100 * (sum without (database, user) (pgbouncer_pools_server_active_connections + pgbouncer_pools_server_idle_connections + pgbouncer_pools_server_used_connections) / clamp_min(pgbouncer_config_max_user_connections,1)) > 90'
for: 2m
labels:
severity: critical
annotations:
summary: PGBouncer server connection saturation critical (instance {{ $labels.instance }})
description: "User connection capacity on {{ $labels.instance }} is above 90% ({{ $value | printf \"%.2f\" }}%), meaning PGBouncer is about to exhaust its configured max_user_connections limit.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"warning
2.6.5.PGBouncer active connections
PGBouncer pools are filling up
# 200 is a rough default; adjust based on your configured pgbouncer pool_size and backend database capacity.
- alert: PgbouncerActiveConnections
expr: 'pgbouncer_pools_server_active_connections > 200'
for: 2m
labels:
severity: warning
annotations:
summary: PGBouncer active connections (instance {{ $labels.instance }})
description: "PGBouncer pools are filling up\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"warning
2.6.6.PGBouncer clients waiting for connection
{{ $value }} client connections are queued in pool {{ $labels.database }}/{{ $labels.user }} waiting for a server connection, indicating pool exhaustion.
# 20 is a rough default; queue depth depends on your traffic volume relative to configured pool_size — adjust based on your workload.
- alert: PgbouncerClientsWaitingForConnection
expr: 'pgbouncer_pools_client_waiting_connections > 20'
for: 2m
labels:
severity: warning
annotations:
summary: PGBouncer clients waiting for connection (instance {{ $labels.instance }})
description: "{{ $value }} client connections are queued in pool {{ $labels.database }}/{{ $labels.user }} waiting for a server connection, indicating pool exhaustion.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"warning
2.6.7.PGBouncer server connection saturation warning
User connection capacity on {{ $labels.instance }} is above 80% ({{ $value | printf "%.2f" }}%), meaning PGBouncer is nearing its configured max_user_connections limit.
- alert: PgbouncerServerConnectionSaturationWarning
expr: '100 * (sum without (database, user) (pgbouncer_pools_server_active_connections + pgbouncer_pools_server_idle_connections + pgbouncer_pools_server_used_connections) / clamp_min(pgbouncer_config_max_user_connections,1)) > 80'
for: 2m
labels:
severity: warning
annotations:
summary: PGBouncer server connection saturation warning (instance {{ $labels.instance }})
description: "User connection capacity on {{ $labels.instance }} is above 80% ({{ $value | printf \"%.2f\" }}%), meaning PGBouncer is nearing its configured max_user_connections limit.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"warning
2.6.8.PGBouncer high client wait time
The oldest queued client in pool {{ $labels.database }}/{{ $labels.user }} has been waiting {{ $value }}s for a server connection, which may indicate pool saturation or slow backend performance.
# 15s threshold is a rough default; depends on your configured pool_size and backend database capacity — adjust based on your workload.
- alert: PgbouncerHighClientWaitTime
expr: 'pgbouncer_pools_client_maxwait_seconds > 15'
for: 2m
labels:
severity: warning
annotations:
summary: PGBouncer high client wait time (instance {{ $labels.instance }})
description: "The oldest queued client in pool {{ $labels.database }}/{{ $labels.user }} has been waiting {{ $value }}s for a server connection, which may indicate pool saturation or slow backend performance.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"