larseen / pgbouncer_exporter Goto Github PK
View Code? Open in Web Editor NEWPrometheus exporter for PgBouncer
License: MIT License
Prometheus exporter for PgBouncer
License: MIT License
Hi,
I installed pgbouncer_exporter ver=0.1.4 with yum in CentOS. My config file /etc/sysconfig/pgbouncer-exporter looks:
OPTIONS="--web.listen-address ':9127'"
DATABASE_URL="postgres://postgres:[email protected]:6432/pgbouncer?sslmode=disable"
pgbouncer-exporter.service is active (running):
pgbouncer-exporter.service - PgBouncer Exporter
Loaded: loaded (/usr/lib/systemd/system/pgbouncer-exporter.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2020-03-25 11:31:26 CET; 1s ago
Main PID: 25603 (pgbouncer_expor)
CGroup: /system.slice/pgbouncer-exporter.service
โโ25603 /usr/sbin/pgbouncer_exporter --web.listen-address :9127 server
Started PgBouncer Exporter.
But I'm getting error message in logs:
level=error msg="unable to get store result: unable to get stats: missing destination name total_xact_count in *[]store.stat" source="exporter.go:229"
It's interesting, because I able connect to pgbouncer:
psql -U postgres -h 127.0.0.1 -p 6432 pgbouncer
Password for user postgres:
psql (12.2, server 1.12.0/bouncer)
Type "help" for help.
Command "show stats" display for me stats and I see total_xact_count
pgbouncer=# show stats;
database | total_xact_count | total_query_count | total_received | total_sent | total_xact_time | total_query_time | total_wait_time | avg_xact_count | avg_query_count | avg_recv | avg_sent | avg_xact_time | avg_query_time | avg_wait_time
-----------+------------------+-------------------+----------------+------------+-----------------+------------------+-----------------+----------------+-----------------+----------+----------+---------------+----------------+---------------
pgbouncer | 3 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0
(1 row)
Where is the problem? Why pgbouncer_exporter can't get stats?
Thanks.
Just to let you know that pgbouncer_up
metric doesn't work. It's 0 when the pgbouncer
service is running.
Also the situation where the pgbouncer
service doesn't work is not handled, exporter
just fails.
We have a Postgres server with 75 dabases. PgBouncer exporter correctly returns databases
and pools
metrics, e.g.
user@db:~$ curl -s metrics-interface:3040/metrics | grep -v "^#" | grep -c pgbouncer_databases_max_connections
75
However we noticed that we only get the pgbouncer_stats_
metrics for the first 9 of the databases:
user@db:~$ curl -s metrics-interface:3040/metrics | grep -v "^#" | grep -c pgbouncer_stats_total_xact_time
9
I'm scaping the exporter directly for the tests above, so our Prometheus scrape or relabeling configuration isn't at play here.
We are also running a build from the latest commit of the exporter.
I fail to see any reasons why we only get stats for 9 DBs from reading the exporter code, AFAICS, it just iterates over the rows returned and prints stats. I verified that show stats
as returned by pgbouncer-admin
return complete stats and went as far as running a packet capture of the traffic between the exporter and PgBouncer to verify stats are returned for all of 75 DBs, they are. We're not running into any resource limits or timeouts on the node.
Do you have any suggestions for how to debug this further or what I'm overlooking or doing wrong? At this point I'm thinking this must be something really obvious, but I fail to see it. Thanks.
We've been using the stanhu/pgbouncer_exporter
fork for a while now. Is there any interest in continuing to work on this exporter?
Otherwise I would propose we move the stanhu/pgbouncer_exporter
fork to be the primary, possibly move it to the prometheus-community
org.
@larseen Will you be open in accepting a PR that exposes PgBouncer config as a metric? Something like
discourse@c00cc6b
I have multiple database with different users:
pgbouncer=# show pools;
database | user | cl_active | cl_waiting | sv_active | sv_idle | sv_used | sv_tested | sv_login | maxwait | pool_mode
-----------------------------+----------------+-----------+------------+-----------+---------+---------+-----------+----------+---------+-------------
gitlabhq_production | chatops | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | transaction
gitlabhq_production | gitlab | 363 | 0 | 1 | 4 | 0 | 0 | 0 | 0 | transaction
gitlabhq_production | gitlab_geo_fdw | 20 | 0 | 2 | 6 | 9 | 0 | 0 | 0 | transaction
gitlabhq_production | pgbouncer | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | transaction
gitlabhq_production_sidekiq | gitlab | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | transaction
gitlabhq_production_sidekiq | pgbouncer | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | transaction
gitlabhq_production_sidekiq | C | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | transaction
pgbouncer | pgbouncer | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | statement
(8 rows)
This results in:
INFO[0036] Starting scrape source="collector.go:282"
An error has occurred during metrics collection:
40 error(s) occurred:
* collected metric pgbouncer_pools_client_active_connections label:<name:"database" value:"gitlabhq_production" > gauge:<value:434 > was collected before with the same name and label values
Thanks for this project! We're looking at shipping a PgBouncer exporter in GitLab but noticed the metric names in this exporter don't adhere to Prometheus naming conventions: https://prometheus.io/docs/practices/naming/
https://github.com/spreaker/prometheus-pgbouncer-exporter#exported-metrics is an example of how the metrics should be named.
The avg
queries can probably also be omitted as well, since Prometheus can calculate averages over any time period needed.
@larseen Appreciate the work (I forked it ~5 years back and added more, and heavily used your work), but you should probably archive this repo since it's no longer maintained. Give a clear signal that folks should look further down the tree.
Just saying...
Hi, thanks for this exporter
after compile, i launch this :
./pgbouncer_exporter -pgBouncer.connectionString "postgres://prometheus:XXXXXX@localhost:6432/pgbouncer?sslmode=disable"
INFO[0000] Starting scrape source="collector.go:285"
INFO[0000] Starting pgbouncer exporter version: (version=, branch=, revision=) source="pgbouncer_exporter.go:49"
INFO[0006] Starting scrape source="collector.go:285"
But, on the metric page, i have this :
An error has occurred during metrics collection:
80 error(s) occurred:
could you help me please?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.