The PgBouncer check tracks connection pool metrics and lets you monitor traffic to and from your application.
The PgBouncer check is included in the Datadog Agent package, so you don't need to install anything else on your PgBouncer nodes.
This check needs an associated user to query your PgBouncer instance:
-
Create a Datadog user in your PgBouncer
pgbouncer.ini
file:stats_users = datadog
-
Add an associated password for the
datadog
user in your PgBounceruserlist.txt
file:"datadog" "<PASSWORD>"
-
To verify the credentials, run the following command:
psql -h localhost -U datadog -p 6432 pgbouncer -c \ "SHOW VERSION;" \ && echo -e "\e[0;32mpgBouncer connection - OK\e[0m" \ || echo -e "\e[0;31mCannot connect to pgBouncer\e[0m"
When it prompts for a password, enter the password you added to the
userlist.txt
.
To configure this check for an Agent running on a host:
-
Edit the
pgbouncer.d/conf.yaml
file, in theconf.d/
folder at the root of your Agent's configuration directory. See the sample pgbouncer.d/conf.yaml for all available configuration options:init_config: instances: ## @param database_url - string - required ## `database_url` parameter should point to PgBouncer stats database url (ie. "pgbouncer") # - database_url: "postgresql://datadog:<PASSWORD>@<HOSTNAME>:<PORT>/<DATABASE_URL>?sslmode=require"
Note: If your instance of PgBouncer does not have SSL support, replace
sslmode=require
withsslmode=allow
to avoid server errors. For details, see the Postgres documentation on SSL support.
Available for Agent versions >6.0
-
Collecting logs is disabled by default in the Datadog Agent, enable it in your
datadog.yaml
file:logs_enabled: true
-
Add this configuration block to your
pgbouncer.d/conf.yaml
file to start collecting your Pgbouncer logs:logs: - type: file path: /var/log/postgresql/pgbouncer.log source: pgbouncer service: "<SERVICE_NAME>"
Change the
path
andservice
parameter values and configure them for your environment. See the sample pgbouncer.d/conf.yaml for all available configuration options.
For containerized environments, see the Autodiscovery Integration Templates for guidance on applying the parameters below.
Parameter | Value |
---|---|
<INTEGRATION_NAME> |
pgbouncer |
<INIT_CONFIG> |
blank or {} |
<INSTANCE_CONFIG> |
{"database_url": "postgresql://datadog:<PASSWORD>@%%host%%:%%port%%/<DATABASE_URL>?sslmode=require"} |
Available for Agent versions >6.0
Collecting logs is disabled by default in the Datadog Agent. To enable it, see Kubernetes Log Collection.
Parameter | Value |
---|---|
<LOG_CONFIG> |
{"source": "pgbouncer", "service": "pgbouncer"} |
Run the Agent's status subcommand and look for pgbouncer
under the Checks section.
See metadata.csv for a list of metrics provided by this check.
Note: Not all metrics are available with all versions of PgBouncer.
The PgBouncer check does not include any events.
See service_checks.json for a list of service checks provided by this integration.
Need help? Contact Datadog support.