Git Product home page Git Product logo

pgbouncer_exporter's Introduction

Pgbouncer exporter

Build Status Docker Pulls Go Report Card

Prometheus exporter for Pgbouncer metrics. The minimum supported version of Pgbouncer is 1.18.

Docker

Metrics are by default exposed on http server running on port 9127 under the /metrics path.

docker run \ 
  --detach \ 
  --env "DATABASE_URL=postgres://user:password@pgbouncer:6432/pgbouncer?sslmode=disable" \
  --publish "9127:9127" \
  --name "pgbouncer_exporter" \
  jbub/pgbouncer_exporter

In order to build the binary for the development docker compose setup you can use this command:

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build

Collectors

All of the collectors are enabled by default, you can control that using environment variables by settings it to true or false.

Name Description Env var Default
stats Per database requests stats. EXPORT_STATS Enabled
pools Per (database, user) connection stats. EXPORT_POOLS Enabled
databases List of configured databases. EXPORT_DATABASES Enabled
lists List of internal pgbouncer information. EXPORT_LISTS Enabled

Default constant prometheus labels

In order to provide default prometheus constant labels you can use the DEFAULT_LABELS enviroment variable. Labels can be set in this format instance=pg1 env=dev. Provided labels will be added to all the metrics.

pgbouncer_exporter's People

Contributors

bdeutra avatar jbub avatar pgvishnuram avatar tearix avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

pgbouncer_exporter's Issues

multiple pgbouncers

Hello, how to use the exporter with many pgbouncer instances, so on a graphana to see more than one line on same graph? Something like a label per host.
Information is gathered through service URL and there is no info about the host, but if exporter is placed in a pod along with the pgbouncer, hostname can be acquired.

pgbouncer_exporter doesn't work with latest PgBouncer 1.16.0 version

PgBouncer 1.16.0 has been released on Aug 9, 2021. This release contains some new features and pgbouncer_exporter doesn't work with it.
I'm getting an error message and no any metrics:
"could not get store result: could not get pools: unexpected column: cl_cancel_req"

When I use PgBouncer 1.15.0 version then everything is OK. Did you plan to release pgbouncer_exporter version compatible with PgBouncer 1.16.0?

Incompatible with pgbouncer version >= 1.18.0

We've seen some new errors in the logs when using pgbouncer versions >= 1.18.0:

2023/05/16 11:37:40 could not get store result: could not get pools: unexpected column: cl_active_cancel_req
2023/05/16 11:37:50 could not get store result: could not get pools: unexpected column: cl_active_cancel_req
2023/05/16 11:38:00 could not get store result: could not get pools: unexpected column: cl_active_cancel_req
2023/05/16 11:38:10 could not get store result: could not get pools: unexpected column: cl_active_cancel_req
2023/05/16 11:38:20 could not get store result: could not get pools: unexpected column: cl_active_cancel_req

pgbouncer/pgbouncer@ea4fb5f

value out of range, please fix

ERRO[0003] unable to get store result: unable to get stats: pq: strconv.ParseInt: parsing "17588200675878996039": value out of range source="exporter.go:391"

db get data parsing error

`pgbouncer_exporter` randomly crashes without any log message

Hi,
Thank you for creating such a useful tool!

The issue I have faced is that my pgbouncer is running together with pgbouncer_exporter in the same kubernetes pod so whenever metrics exporter encounters an error it restarts entire pod. I am not seeing any error logs reported by pgbouncer_exporter but it's been killed. I am not familiar with go language at all, just wondering are there any try/catch statements so if something unexpected happens you catch and log something to stdout and rethrow an exception again?

Also are you planning on maintaining this repository? I have noticed decreased number of commits / unresolved prs & issues etc.

Versions:
pgbouncer - bitnami/pgbouncer:1.18.0
pgbouncer_exporter - PGBOUNCER_EXPORTER_VERSION="0.14.0"
go version - GO_VERSION="1.19.3"

Again thank you for your time!

Base image is old enough that security cannot be reliably checked

FROM iron/go

The base image in this Dockerfile is 3 years old, and is based on a version of Alpine that reached end-of-support over a year ago.

$ date
Mon Dec 14 16:48:48 PST 2020
$ docker run --rm -ti iron/go sh
Unable to find image 'iron/go:latest' locally
latest: Pulling from iron/go
1eae7a7426b0: Pull complete
5dd3d2345e00: Pull complete
Digest: sha256:7006ab5716c392b003f1da7a07a49171989c5c78cbf764a0371832b49767023b
Status: Downloaded newer image for iron/go:latest
/ # cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.7.0
PRETTY_NAME="Alpine Linux v3.7"
HOME_URL="http://alpinelinux.org"
BUG_REPORT_URL="http://bugs.alpinelinux.org"
/ #

It's old enough that security scanners are just saying ๐Ÿคทโ€โ™‚๏ธ or "The vulnerability detection may be insufficient because security updates are not provided".

Reset Pool Mode Counter

While experimenting with getting pgbouncer itself with the correct pool mode. I noticed that if you switch a user between pool modes, the exporter does not reset the gauge for a pool mode that goes away for a user back to 0.

ie I switched a user from transaction to session for their pool mode so their session pool mode shows up:

pgbouncer_exporter_pools_active_clients{database="my_db",pool_mode="session",user="my_user} 10

but their transaction pool_mode continues to as well:

pgbouncer_exporter_pools_active_clients{database="my_db",pool_mode="transaction",user="my_user"} 10

As a note, restarting the exporter does fix this.

pq username error

Tryign to use this exporter I get this error:

unable to initialize store: pq: Could not detect default username. Please provide one explicitly

I guess the exporter expects access with an specific username?

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.