postgres_exporter:Failed to create PostgresCollector

I have a question here. When I execute postgres_exporter on the monitoring node, an error is reported.
The following is the error log:

[root@ocbc postgres_exporter]# ./postgres_exporter
ts=2022-09-05T10:07:13.883Z caller=main.go:124 level=error msg=“Failed to create PostgresCollector” err=“malformed dsn ""”

Here someone tell me why,please! :pray:

The DSN refers to your database connection parameters, username, password, IP, that kind of things, something related with DSN is wrong.
Try this:

sudo -u postgres DATA_SOURCE_NAME=“postgresql://postgres_exporter:POSTGRE_REP_PASS@localhost/postgres?sslmode=disable” /usr/bin/prometheus-postgres-exporter

1 Like

I just created an account to say thank you. fixed my issue :slight_smile: