Send PgBouncer metrics to Axiom
This page explains how to send PgBouncer metrics to Axiom using pgbouncer_exporter and the OpenTelemetry Collector.
PgBouncer tracks detailed pool and query statistics, but it only exposes them through its admin console (SHOW STATS, SHOW POOLS) over the PostgreSQL wire protocol — there’s no native Prometheus or OTLP endpoint. To send these metrics to Axiom, run the Prometheus community’s pgbouncer_exporter next to PgBouncer, and an OpenTelemetry Collector that scrapes the exporter and forwards the metrics to Axiom.
Prerequisites
- Create an Axiom account.
- Create a dataset in Axiom where you send your data.
- Create an API token in Axiom with permissions to ingest data to the dataset you have created.
Expose PgBouncer stats with pgbouncer_exporter
In pgbouncer.ini, allow a user to read stats and let the exporter connect:
Then run the exporter, pointing it at PgBouncer’s special pgbouncer admin database:
Replace the connection string with your PgBouncer host, port, and stats user. You can also set it with the PGBOUNCER_EXPORTER_CONNECTION_STRING environment variable. The exporter then serves metrics at http://localhost:9127/metrics.
Configure the OpenTelemetry Collector
Add a Prometheus receiver that scrapes the exporter and an OTLP/HTTP exporter that sends data to Axiom:
Query your metrics
Once data is flowing, query your PgBouncer metrics like any other OTel metrics in Axiom. Pool metrics carry database and user tags. For example, to chart active client connections per database:
For more information, see Metrics.