prometheus-community / postgres_exporter

A PostgreSQL metric exporter for Prometheus
Apache License 2.0
2.76k stars 732 forks source link

SCRAM-SHA-256 is not supported by postgres exporter, getting authentication failed error #896

Open amitvermaa3101 opened 1 year ago

amitvermaa3101 commented 1 year ago

What did you do?

What did you expect to see? Postgres exporter must be able to connect to postgres database if SCRAM-SHA-256 is enabled .

What did you see instead? Under which circumstances? Getting this error:- Aug 28 08:56:13 HOSTNAME postgres_exporter[2177291]: ts=2023-08-28T08:56:13.556Z caller=server.go:74 level=info msg="Established new database connection" fingerprint=localhost:5432 Aug 28 08:56:14 XXXXXXXX.com postgres_exporter[2177291]: ts=2023-08-28T08:56:14.562Z caller=postgres_exporter.go:691 level=error err="Error opening connection to database (postgresql://postgres_exporter:PASSWORD_REMOVED@localhost:5432/postgres?sslmode=disable): pq: password authentication failed for user \"postgres_exporter\""

Postgres exporter is unable to connect to postgres database . Both postgres exporter and Postgres database are running on same server.

Environment

Linux 4.18.0-425.19.2.el8_7.x86_64 x86_64

insert list of flags used here
sysadmind commented 1 year ago

Are you able to post a minimal example of running postgres in this way so that we can investigate and test a fix? A docker example is easiest for me. I want to be sure I understand the problem and how to fix it since we rely on an upstream postgres driver.

amitvermaa3101 commented 1 year ago

Hi,

We are using enterprise postgres and below is the line added in pg_hba.conf

host all all 0.0.0.0/0 scram-sha-256

Both postgres cluster instance and postgres exporter are running on same DB server...

Hoping that above information is helpful else please help me to understand what are you looking for .

amitvermaa3101 commented 1 year ago

hi , Any update? Please consider this issue on priority since due to this issue we are unable to monitor PG14 targets ....