timescale / prometheus-postgresql-adapter

Use PostgreSQL as a remote storage database for Prometheus
Apache License 2.0
335 stars 66 forks source link

postgres-adapter authentication failed for 'postgres' db #78

Open admiral-manjinder opened 5 years ago

admiral-manjinder commented 5 years ago

I am setting this up in kubernetes and getting the below error in adapter logs

_level=info ts=2019-05-10T09:28:20.158622915Z caller=log.go:25 config="&{remoteTimeout:30000000000 listenAddr::9201 telemetryPath:/metrics pgPrometheusConfig:{host:pg-prometheus port:5432 user:postgres password: database:postgres schema: sslMode:disable table:metrics copyTable: maxOpenConns:50 maxIdleConns:10 pgPrometheusNormalize:true pgPrometheusLogSamples:true pgPrometheusChunkInterval:43200000000000 useTimescaleDb:true dbConnectRetries:0 readOnly:false} logLevel:debug haGroupLockId:0 restElection:false prometheusTimeout:-1}" level=info ts=2019-05-10T09:28:20.15875991Z caller=log.go:25 msg="host=pg-prometheus port=5432 user=postgres dbname=postgres password='' sslmode=disable connecttimeout=10" level=error ts=2019-05-10T09:28:20.162595001Z caller=log.go:33 err="pq: password authentication failed for user \"postgres\""

I have also tried adding below line to my pg_hba.conf but no luck: host postgres postgres 0.0.0.0/0 trust

Surprisingly if i create another separate DB with some credentials while spinning up pg_prometheus and pass its credentials to postgres-adapter, it is able to connect seamlessly. But that is not of much help because apparently we cannot use any db but 'postgres' due to the required initial setup being already done in it.

Please help me get through this.

spolcyn commented 5 years ago

Can you try setting the postgres user's password in pg_prometheus, and then putting that password in your config file in the appropriate place? The flag is -pg.password=. This tutorial also could be helpful, specifically the Spin up Pg_Prometheus step and the Docker configs.

bboule commented 5 years ago

Hello... When you spin up the Timescale Prometheus adapter as you passing in the password for the postgres user? It is unclear if you are not passing it in or simply removed it from the log entry you pasted in? from what I can see you may be failing in so far as you are not passing in a password? and rather than trust in your HBA add md5 let us know how it goes..