postgres_exporter icon indicating copy to clipboard operation
postgres_exporter copied to clipboard

Monitor multiple databases cause HTTP error 500

Open ghost opened this issue 4 years ago • 2 comments

My environment Platform : Kubernetes 1.14.8 Database : Postgres 11.5.0

Hi, everyone !

Currently, I'm facing a problem with postgres_exporter when I'm trying to monitor multiple databases. I followed advices from #424 but from Prometheus Web UI, I still get HTTP error 500. But when, I modify DATA_SOURCE_NAME variable to monitor only one database, it works fine...

My pod still up and running without crash.

Environment variable DATA_SOURCE_NAME="postgresql://<userName1>:<userPassword1>@<serverName>:<port>/<databaseName>?sslmode=require,postgresql://<userName2>:<userPassword2>@<serverName>:<port>/<databaseName>?sslmode=require"

Pod (logs) time="2020-09-08T14:21:30+02:00" level=info msg="Established new database connection to \"<serverName>:<port>\"." source="postgres_exporter.go:878" time="2020-09-08T14:21:35+02:00" level=info msg="Semantic Version Changed on \"<serverName>:<port>0.0.0 -> 11.5.0" source="postgres_exporter.go:1405" time="2020-09-08T14:21:35+02:00" level=info msg="Established new database connection to \"<serverName>:<port>\"." source="postgres_exporter.go:878" time="2020-09-08T14:21:35+02:00" level=info msg="Semantic Version Changed on \"<serverName>:<port>\": 0.0.0 -> 11.5.0" source="postgres_exporter.go:1405" time="2020-09-08T14:21:35+02:00" level=info msg="Starting Server: :9187" source="postgres_exporter.go:1672"

Does anyone run into the same problem ?

ghost avatar Sep 08 '20 13:09 ghost

I've run into this problem as well.

I believe it's because the exporter does not add a label to each metric per database.

UPDATE: AFAICT this only seems to affect custom metrics

zoonage avatar Feb 17 '21 16:02 zoonage

Note that if you're adding the postgres-exporter with the Helm chart, there are "custom metrics" added by default, which can cause this. You may have to exclude these (config.queries="") to get around this.

nrmitchi avatar May 29 '21 17:05 nrmitchi