Stackstate-PGBouncer Integration

Overview

The PgBouncer check tracks connection pool metrics and lets you monitor traffic to and from your application.

Setup

Installation

The PgBouncer check is packaged with the Agent, so simply install the Agent on your PgBouncer nodes.

Configuration

Create a file pgbouncer.yaml in the Agent’s conf.d directory:

init_config:

instances:
  - host: localhost
    port: 15433
    username: <YOUR_USERNAME>
    password: <YOUR_PASSWORD>
#   tags:
#     - env:prod
  - database_url: postgresql://<DB_USER>:<DB_PASS>@<DB_HOST>:<DB_PORT>/dbname?sslmode=require
#   tags:
#     - role:main

Restart the Agent to start sending PgBouncer metrics to Datadog.

Validation

Run the Agent’s info subcommand and look for pgbouncer under the Checks section:

  Checks
  ======
    [...]

    pgbouncer
    -------
      - instance #0 [OK]
      - Collected 26 metrics, 0 events & 1 service check

    [...]

Compatibility

The PgBouncer check is compatible with all major platforms.

Data Collected

Metrics

pgbouncer.stats.requests_per_second
(gauge)
The request rate
shown as request
pgbouncer.stats.bytes_received_per_second
(gauge)
The total network traffic received
shown as byte
pgbouncer.stats.bytes_sent_per_second
(gauge)
The total network traffic sent
shown as byte
pgbouncer.stats.total_query_time
(gauge)
Time spent by pgbouncer actively querying PostgreSQL
shown as microsecond
pgbouncer.stats.avg_req
(gauge)
The average number of requests per second in last stat period
shown as request
pgbouncer.stats.avg_recv
(gauge)
The client network traffic received
shown as byte
pgbouncer.stats.avg_sent
(gauge)
The client network traffic sent
shown as byte
pgbouncer.stats.avg_query
(gauge)
The average query duration
shown as microsecond
pgbouncer.pools.cl_active
(gauge)
Client connections linked to server connection and able to process queries
shown as connection
pgbouncer.pools.cl_waiting
(gauge)
Client connections waiting on a server connection
shown as connection
pgbouncer.pools.sv_active
(gauge)
Server connections linked to a client connection
shown as connection
pgbouncer.pools.sv_idle
(gauge)
Server connections idle and ready for a client query
shown as connection
pgbouncer.pools.sv_used
(gauge)
Server connections idle more than server_check_delay, needing server_check_query
shown as connection
pgbouncer.pools.sv_tested
(gauge)
Server connections currently running either server_reset_query or server_check_query
shown as connection
pgbouncer.pools.sv_login
(gauge)
Server connections currently in the process of logging in
shown as connection
pgbouncer.pools.maxwait
(gauge)
Age of oldest unserved client connection
shown as second

Events

The PGbouncer check does not emit any events.

Service Checks

pgbouncer.can_connect: Agent is able to connect to the pgbouncer instance

Troubleshooting

Further Reading