Skip to main content
APA
Sponsored by CAST AI — Kubernetes cost optimization Better Stack — Uptime monitoring and log management
⚠️

Alert thresholds depend on the nature of your applications. Some queries may have arbitrary tolerance thresholds. Building an efficient monitoring platform takes time. 😉

PGBouncer Prometheus Alert Rules

3 Prometheus alerting rules for PGBouncer. Exported via spreaker/prometheus-pgbouncer-exporter. These rules cover critical and warning conditions — copy and paste the YAML into your Prometheus configuration.

wget https://raw.githubusercontent.com/samber/awesome-prometheus-alerts/refs/heads/master/dist/rules/pgbouncer/spreaker-pgbouncer-exporter.yml
warning

2.6.1. PGBouncer active connections

PGBouncer pools are filling up

- 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.2. PGBouncer errors

PGBouncer is logging errors. This may be due to a server restart or an admin typing commands at the pgbouncer console.

- alert: PGBouncerErrors
  expr: increase(pgbouncer_errors_count{errmsg!="server conn crashed?"}[1m]) > 10
  for: 0m
  labels:
    severity: warning
  annotations:
    summary: PGBouncer errors (instance {{ $labels.instance }})
    description: "PGBouncer is logging errors. This may be due to a server restart or an admin typing commands at the pgbouncer console.\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: increase(pgbouncer_errors_count{errmsg="no more connections allowed (max_client_conn)"}[2m]) > 0
  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 }}"