Skip to content
BleemeoBleemeo

PgBouncer

Auto-Detection
Built-in Metrics

PgBouncer is a lightweight connection pooler for PostgreSQL.

Glouton detects PgBouncer by its process and listening port (default: 6432).

To gather metrics, Glouton connects to PgBouncer’s virtual pgbouncer administration database and runs its SHOW commands. This requires a user (default: pgbouncer) that is allowed to query it — see the stats_users and admin_users settings in your PgBouncer configuration.

If the auto-detected parameters are incorrect, override them manually:

Terminal window
sudo tee /etc/glouton/conf.d/99-pgbouncer.conf > /dev/null << 'EOF'
service:
# For a PgBouncer running outside a container
- type: "pgbouncer"
username: "pgbouncer"
password: "PASSWORD"
address: "127.0.0.1"
port: 6432
# For a PgBouncer running in a Docker container
- type: "pgbouncer"
instance: "CONTAINER_NAME"
username: "pgbouncer"
password: "PASSWORD"
address: "172.17.0.2"
port: 6432
EOF

Glouton automatically detects configuration changes.

MetricDescription
service_statusStatus of PgBouncer
pgbouncer_pools_cl_activeClient connections linked to a server connection and able to process queries
pgbouncer_pools_cl_waitingClient connections that have sent a query but are waiting for a server connection
pgbouncer_pools_maxwaitTime the oldest waiting client has waited for a server connection, in seconds
pgbouncer_pools_sv_activeServer connections currently assigned to a client
pgbouncer_pools_sv_idleServer connections that are idle and ready to serve a new query
pgbouncer_queryNumber of SQL queries pooled per second
pgbouncer_query_time_secondsAverage time spent by PgBouncer processing a query, in seconds
pgbouncer_received_bytesNetwork traffic received by PgBouncer, in bytes per second
pgbouncer_sent_bytesNetwork traffic sent by PgBouncer, in bytes per second

To also monitor the PostgreSQL server behind PgBouncer, see PostgreSQL.