postgres_exporter
postgres_exporter copied to clipboard
DATA_SOURCE_URI did not support unix_socket?
hi!
I ran into a problem when using the DATA_SOURCE_URI variable - there is no way to pass unix socket as host. At the same time, the --auto-discover-databases mode does not work when using DATA_SOURCE_NAME in principle.
i tried various variants of DATA_SOURCE_URI:
export DATA_SOURCE_URI="/one?host=/tmp"export DATA_SOURCE_URI="/one?sslmode=disable&host=/tmp"export DATA_SOURCE_URI="%2Ftmp:5432/one?sslmode=disable"
At best, this line parsed but did not use a local socket.
INFO[0000] Established new database connection to "localhost:5432". source="postgres_exporter.go:878" INFO[0000] Semantic Version Changed on "localhost:5432": 0.0.0 -> 12.6.0 source="postgres_exporter.go:1405"
Is there a universal way to write a connection string with using any keys? postgres_exporter version: 0.8.0
I don't use /tmp, but I am using /var/run/postgresql and this is working for me:
DATA_SOURCE_URI="prometheus@:5432/postgres?host=/var/run/postgresql"
For some reasons, the port is required.
For some reasons, the port is required.
I think the port is needed because the socket file contains the port. e.g. .s.PGSQL.nnnn -> .s.PGSQL.5432
Since the README marks DATA_SOURCE_NAME as legacy the examples in it should be adjusted as well.