PgBouncer collector
PgBouncer is an open-source connection pooler for PostgreSQL.
This module monitors one or more PgBouncer servers, depending on your configuration.
Executed queries:
SHOW VERSION;
SHOW CONFIG;
SHOW DATABASES;
SHOW STATS;
SHOW POOLS;
Information about the queries can be found in the PgBouncer Documentation.
Requirements
- PgBouncer v1.8.0+.
- A user with
stats_users
permissions to query your PgBouncer instance.
To create the netdata
user:
Add
netdata
user to thepgbouncer.ini
file:stats_users = netdata
Add a password for the
netdata
user to theuserlist.txt
file:"netdata" "<PASSWORD>"
To verify the credentials, run the following command
psql -h localhost -U netdata -p 6432 pgbouncer -c "SHOW VERSION;" >/dev/null 2>&1 && echo OK || echo FAIL
When it prompts for a password, enter the password you added to
userlist.txt
.
Metrics
All metrics have "pgbouncer." prefix.
Labels per scope:
- global: no labels.
- database: database, postgres_database.
Metric | Scope | Dimensions | Units |
---|---|---|---|
client_connections_utilization | global | used | percentage |
db_client_connections | database | active, waiting, cancel_req | connections |
db_server_connections | database | active, idle, used, tested, login | connections |
db_server_connections_utilization | database | used | percentage |
db_clients_wait_time | database | time | seconds |
db_client_max_wait_time | database | time | seconds |
db_transactions | database | transactions | transactions/s |
db_transactions_time | database | time | seconds |
db_transaction_avg_time | database | time | seconds |
db_queries | database | queries | queries/s |
db_queries_time | database | time | seconds |
db_query_avg_time | database | time | seconds |
db_network_io | database | received, sent | B/s |
Configuration
Edit the go.d/pgbouncer.conf
configuration file using edit-config
from the
Netdata config directory, which is typically at /etc/netdata
.
cd /etc/netdata # Replace this path with your Netdata config directory
sudo ./edit-config go.d/pgbouncer.conf
DSN (Data Source Name) may either be in URL format or key=word format. See Connection Strings for details.
jobs:
- name: local
dsn: 'postgres://postgres:[email protected]:6432/pgbouncer'
- name: local
dsn: 'host=/tmp dbname=pgbouncer user=postgres port=6432'
- name: remote
dsn: 'postgres://postgres:[email protected]:6432/pgbouncer'
For all available options see module configuration file.
Troubleshooting
To troubleshoot issues with the pgbouncer
collector, run the go.d.plugin
with the debug option enabled. The output
should give you clues as to why the collector isn't working.
Navigate to the
plugins.d
directory, usually at/usr/libexec/netdata/plugins.d/
. If that's not the case on your system, opennetdata.conf
and look for theplugins
setting under[directories]
.cd /usr/libexec/netdata/plugins.d/
Switch to the
netdata
user.sudo -u netdata -s
Run the
go.d.plugin
to debug the collector:./go.d.plugin -d -m pgbouncer
Do you have any feedback for this page? If so, you can open a new issue on our netdata/learn repository.