[In Development] Monitoring PgBouncer

Configure the Server Density agent to monitor your PgBouncer pool to:

• Collect important metrics, such as queue size
• Identify overall server slowdowns caused by the pool

Note: This plugin is still in development and is not yet available to install. We will add new plugins to our release notes.

Monitored metrics

  • pgbouncer.stats.bytes_received_per_second
  • pgbouncer.stats.requests_per_second
  • pgbouncer.stats.bytes_sent_per_second
  • pgbouncer.stats.total_query_time
  • pgbouncer.stats.avg_req
  • pgbouncer.stats.avg_recv
  • pgbouncer.stats.avg_sent
  • pgbouncer.stats.avg_query
  • pgbouncer.pools.cl_active
  • pgbouncer.pools.cl_waiting
  • pgbouncer.pools.sv_active
  • pgbouncer.pools.sv_idle
  • pgbouncer.pools.sv_used
  • pgbouncer.pools.sv_tested
  • pgbouncer.pools.sv_login
  • pgbouncer.pools.maxwait
  • pgbouncer.can_connect

Configuring the agent to monitor PgBouncer

1. Connect to psql and create a monitoring user:

CREATE USER serverdensity WITH PASSWORD 'supersecretpassword';
GRANT SELECT ON pg_stat_database TO serverdensity;

2. Add serverdensity to your PgBouncer userlist.txt

echo '"serverdensity" "supersecretpassword"' >> /path/to/userlist.txt

3. Configure /etc/sd-agent/conf.d/pgbouncer.yaml


- host: localhost
port: 15432
username: serverdensity
password: supersecretpassword

4. Restart the agent

sudo /etc/init.d/sd-agent restart

Verifying the configuration
Execute info to verify the configuration with the following:

sudo /etc/init.d/sd-agent info 

If the agent has been configured correctly you’ll see an output such as:

  - instance #0 [OK]
  - Collected 20 metrics & 1 service checks

Configuring graphs

Click the name of your server from the Devices list in your Server Density account then go to the Metrics tab. Click the + Graph button on the right then choose the PgBouncer metrics to display the graphs. The metrics will also be available to select when building dashboard graphs.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Monday  —  Friday.

10am  —  6pm UK.

Dedicated Support.