Logging is here!

PGBouncer

Agent Check Agent Check

Supported OS: Linux Mac OS

Overview

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

Setup

Installation

The PgBouncer check is included in the Datadog Agent package, so you don’t need to install anything else on your PgBouncer nodes.

Configuration

Edit the pgbouncer.d/conf.yaml file, in the conf.d/ folder at the root of your Agent’s directory. See the sample pgbouncer.d/conf.yaml for all available configuration options:

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

Note: database_url parameter value should point to PgBouncer stats database.

In your PgBouncer userlist.txt file add

  "datadog" "<your_pass>"

Next, in your PgBouncer pgbouncer.ini file add

stats_users = datadog

Restart the Agent to start sending PgBouncer metrics to Datadog.

Validation

Run the Agent’s status subcommand and look for pgbouncer under the Checks section.

Data Collected

Metrics

pgbouncer.stats.requests_per_second
(rate)
The request rate
shown as request
pgbouncer.stats.queries_per_second
(rate)
The query rate
shown as query
pgbouncer.stats.transactions_per_second
(rate)
The transaction rate
shown as transaction
pgbouncer.stats.bytes_received_per_second
(rate)
The total network traffic received
shown as byte
pgbouncer.stats.bytes_sent_per_second
(rate)
The total network traffic sent
shown as byte
pgbouncer.stats.total_query_time
(rate)
Time spent by pgbouncer actively querying PostgreSQL
shown as microsecond
pgbouncer.stats.total_transaction_time
(rate)
Time spent by pgbouncer in transactions
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_query_count
(gauge)
The average number of queries per second in last stat period
shown as query
pgbouncer.stats.avg_transaction_count
(gauge)
The average number of transactions per second in last stat period
shown as transaction
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.stats.avg_query_time
(gauge)
The average query duration
shown as microsecond
pgbouncer.stats.avg_transaction_time
(gauge)
The average transaction 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

Note: Not all metrics are available with all versions of PgBouncer.

Events

The PgBouncer check does not include any events at this time.

Service Checks

pgbouncer.can_connect:

Returns CRITICAL if the Agent cannot connect to PgBouncer to collect metrics, otherwise OK.

Troubleshooting

Need help? Contact Datadog Support.

Further Reading

Learn more about infrastructure monitoring and all our integrations on our blog