Open M1ha-Shvn opened 3 years ago
I am using this and working for me:
DATA_SOURCE_URI="postgres@:5432/postgres?host=/var/run/postgresql"
The port has to be there and cannot be empty, for some reasons.
hi [Unit]
Description=Prometheus PostgreSQL Exporter
After=network.target
[Service]
Type=simple
Restart=always
User=postgres
Group=postgres
EnvironmentFile=/var/lib/pgsql/11/env
ExecStart=/usr/local/bin/postgres_exporter
[Install]
WantedBy=multi-user.target
Внутри файла env : DATA_SOURCE_NAME="user=postgres host=/var/run/postgresql/ sslmode=disable"
Hi. My goal is to use
/var/run/postgresql/
as DSN host withPG_EXPORTER_AUTO_DISCOVER_DATABASES
enabled. But I can't figure out correct way to do this, seems a bug.First attempt: DSN
Readme offers such DSN:
DATA_SOURCE_NAME="user=postgres host=/var/run/postgresql/ sslmode=disable"
But when I use it I get errors for non default databases:Looks like databases found by auto discover are forming wrong dsn.
Second attempt: URI
Correct equal URI as recomended in PostgreSQL docs:
DATA_SOURCE_NAME="postgresql://postgres@/postgres?host=/var/run/postgresql&sslmode=disable"
But library ignores
/
symbol after@
. It is important as it means I set database name, not host. URI from logs looks like:"postgresql://postgres@carrot_shard_1?host=/var/run/postgresql&sslmode=disable"
Logs: