Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hardcoded db-name, and sslmode=disabled not recognized #109

Open
sandeepkalra opened this issue Mar 24, 2023 · 0 comments
Open

hardcoded db-name, and sslmode=disabled not recognized #109

sandeepkalra opened this issue Mar 24, 2023 · 0 comments

Comments

@sandeepkalra
Copy link

Hi Team:

Thank you for your great contibution.

I am trying to use the prebuild binary (pgbouncer_exporter version 0.6.0 linux amd64) in my micro-service. I am automating it via supervisord. As you can see that the connection string here has ?sslmode=disable,
but the error shows up saying that SSL is disabled and the program quits.

I have tried different users as well (postgres user and root user). I also tried changing the database name
in connection-string to 'pgbouncer' , 'postgres' etc. Here is the entries on my setup:

-- supervisord config --
[program:bouncer_metrics]
autorestart=true command=pgbouncer_exporter --log.level=debug --log.format=json --web.listen-address=":9007" --pgBouncer.connectionString="postgresql://sankalra:[email protected]:6432/bouncer_postgres?sslmode=disable" --pgBouncer.pid-file=/
dev/shm/pg_bouncer.pid
stderr_logfile=/dev/log/bouncer_exporter.err
stdout_logfile=/dev/log/bouncer_exporter.log

-- logs : bouncer_exporter.err --
{"caller":"collector.go:138","err":"error pinging pgbouncer: pq: SSL is not enabled on the server","level":"error","msg":"error setting up DB connection","ts":"2023-03-24T19:42:23.608Z"}
{"caller":"collector.go:138","err":"error pinging pgbouncer: pq: SSL is not enabled on the server","level":"error","msg":"error setting up DB connection","ts":"2023-03-24T19:42:23.710Z"}
{"caller":"collector.go:138","err":"error pinging pgbouncer: pq: SSL is not enabled on the server","level":"error","msg":"error setting up DB connection","ts":"2023-03-24T19:42:23.829Z"}

I have looked at code. The system try to connect to DB at collector.go:L138 -> Calls Other function on collector.go:L333
and I see this code:
db, err := sql.Open("postgres", conn)

-1:
My question is "why is database name 'postgres' hard-coded"? and not pulled from dsn or connectionString ?
I do not have postgres db in my system. I do not have pgbouncer db as well? I do have bouncer_postgres as alias db.
I did tried the two db names also but it still failed.

-2:
The error issue is it telling that SSL is not enabled. However, I do have ?sslmode=disable. Is this some side effect of new TLS work done? I haven't digged into it yet
-3:
I did tried to build the system but one of the go library for logger and flags is not
available in github for v2 version that it tries to build with, and i am not sure if
that is something that is being maintained by one of the developers in this community.
The failure to build out of box means that a lot of developers that would like to contribute cannot.

I hope someone from core team will kindly respond here!
Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant