prometheus-community / pgbouncer_exporter

Prometheus exporter for PgBouncer
MIT License
143 stars 52 forks source link

How to correctly specify the connection string #75

Open vetalfw opened 2 years ago

vetalfw commented 2 years ago

Could you tell me how to correctly specify the connection string if there is a dash in the name of my database. Connection string example:

- --pgBouncer.connectionString=postgres://$(DB_USER):$(DB_PASSWORD)@127.0.0.1:5432/tmp-test-db?sslmode=disable&connect_timeout=10

The error I am getting:

{"caller":"collector.go:129","err":"error pinging pgbouncer: \"pq: unrecognized configuration parameter \\\"stats\\\"\"","level":"error","msg":"error setting up DB connection","ts":"2022-05-10T19:56:15.348Z"}

Or I can't use the current database and I need to create a new one? Could you please helm me? Thanks

anwareset commented 2 years ago

I got similar issue

vuducmanh11 commented 2 years ago

+1 same error, looks like code is outdated

RezaImany commented 1 year ago

your database name specified wrong! you must define a user for admin user and set admin_users = someuser in your pgbouncer.ini file its obvious this user must be defined in your auth_file! and this user can read metrics data on pgbonucer database so your connection string goes like this (with correct flag): --pgBouncer.connectionString="postgres://$YOUR_USERNAME:$YOUR_PASS@$HOST:$PORT/pgbouncer?sslmode=disable"

you must keep pgbouncer as database name

originell commented 1 year ago

Maybe the following will be helpful for other people stumbling over this:

vvitad commented 11 months ago

Hello, everyone! Does anyone know how to

originell commented 11 months ago

@vvitad just guessing here, but did you…

vvitad commented 11 months ago

hi, @originell! thanks for the reply password contains _, yesterday I've created environment variable for the whole connection string and it worked

Environment="DATA_SOURCE_NAME=pgBouncer.connectionString=postgresql://pgbouncer:pgbouncer_password@host:port/pgbouncer?sslmode=disable"
ExecStart=....--${DATA_SOURCE_NAME} 

still struggling with changing timezone though. ts (timestamp) in logs is incorrect