Git Product home page Git Product logo

pgbouncer_exporter's Introduction

PgBouncer exporter

Prometheus exporter for PgBouncer. Exports metrics at 9127/metrics

Building and running

make
./pgbouncer_exporter <flags>

To see all available configuration flags:

./pgbouncer_exporter -h

Metrics

Metric Description
stats.avg_query_count Average queries per second in last stat period
stats.avg_query The average query duration, shown as microsecond
stats.avg_query_time Average query duration in microseconds
stats.avg_recv Average received (from clients) bytes per second
stats.avg_req The average number of requests per second in last stat period, shown as request/second
stats.avg_sent Average sent (to clients) bytes per second
stats.avg_wait_time Time spent by clients waiting for a server in microseconds (average per second)
stats.avg_xact_count Average transactions per second in last stat period
stats.avg_xact_time Average transaction duration in microseconds
stats.bytes_received_per_second The total network traffic received, shown as byte/second
stats.bytes_sent_per_second The total network traffic sent, shown as byte/second
stats.total_query_count Total number of SQL queries pooled
stats.total_query_time Total number of microseconds spent by pgbouncer when actively connected to PostgreSQL, executing queries
stats.total_received Total volume in bytes of network traffic received by pgbouncer, shown as bytes
stats.total_requests Total number of SQL requests pooled by pgbouncer, shown as requests
stats.total_sent Total volume in bytes of network traffic sent by pgbouncer, shown as bytes
stats.total_wait_time Time spent by clients waiting for a server in microseconds
stats.total_xact_count Total number of SQL transactions pooled
stats.total_xact_time Total number of microseconds spent by pgbouncer when connected to PostgreSQL in a transaction, either idle in transaction or executing queries
pools.cl_active Client connections linked to server connection and able to process queries, shown as connection
pools.cl_waiting Client connections waiting on a server connection, shown as connection
pools.sv_active Server connections linked to a client connection, shown as connection
pools.sv_idle Server connections idle and ready for a client query, shown as connection
pools.sv_used Server connections idle more than server_check_delay, needing server_check_query, shown as connection
pools.sv_tested Server connections currently running either server_reset_query or server_check_query, shown as connection
pools.sv_login Server connections currently in the process of logging in, shown as connection
pools.maxwait Age of oldest unserved client connection, shown as second

pgbouncer_exporter's People

Contributors

aravind avatar larseen avatar xbglowx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pgbouncer_exporter's Issues

SHOW POOLS fails to scrape if multiple databases with different users are present

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

Continue work on this exporter?

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.

Mark the repo as archived

@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...

pb metric collection

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:

  • collected metric pgbouncer_pools_cl_active label:<name:"database" value:"symfony" > gauge:<value:0 > was collected before with the same name and label values

could you help me please?

missing destination name total_xact_count in *[]store.stat

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.

pgbouncer_up metric always 0

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.

SHOW STATS only returns results for the first 9 databases

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.

Rename metrics to adhere to Prometheus metric naming conventions

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.