Description
I consistently have problems using DATA_SOURCE_NAME with more than one URI if the ports are not standard.
I understand from this sentences:
Also, you can set a list of sources to scrape different instances from the one exporter setup. Just define a comma separated string.
sudo -u postgres DATA_SOURCE_NAME="port=5432,port=6432" postgres_exporter
What I did is to set this variable:
DATA_SOURCE_NAME="postgresql://postgres:[email protected]:5434/postgres?sslmode=disable,postgresql://postgres:[email protected]:5432/postgres?sslmode=disable"
just for readability I'll write it this way:
DB1=10.1.201.11:5434
DB2=10.1.201.11:5432
OPTS=postgres?sslmode=disable
DATA_SOURCE_NAME="postgresql://postgres:xxx@$DB1$OPTS,postgresql://postgres:xxx@$DB1$OPTS"
What did you do?
I tested each database alone, and it worked.
As long as DB1 and DB2 use port 5432 the exporter works and I get rows for each target (clearly on different servers). If I use other ports (5434, 5435...) I get an error:
# wget -O - localhost:9187/metrics
--2022-01-26 23:47:17-- http://localhost:9187/metrics
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:9187... connected.
HTTP request sent, awaiting response... 500 Internal Server Error
2022-01-26 23:47:17 ERROR 500: Internal Server Error.
What did you expect to see?
I expect it to work correctly on any port...
Environment
I did the tests with PostgreSQL 14 on Ubuntu 20.04 using binary 0.10.0
# uname -srm
Linux 5.4.0-80-generic x86_64
# postgres_exporter --version
postgres_exporter, version 0.10.0 (branch: HEAD, revision: 57719ba53cac428769aaf3c4c0bb742df3cfca98)
build user: root@4dcb2c7f1315
build date: 20210709-11:49:20
go version: go1.16.5
platform: linux/amd64
- postgres_exporter flags:
not using any flags
I initially verified the same behaviour working in kubernetes.