-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
Hello,
When I run pg_exporter, there's a conflict with existing libpq environment variables that are already set. When I unset them, I can start the exporter.
$ > pg_exporter --url="$PG_EXPORTER_URL" --log.level=debug
time=2025-09-09T12:05:14.582+01:00 level=DEBUG msg="init pg_exporter, configPath= constLabels= disableCache=false autoDiscovery=false excludeDatabase=template0,template1,postgres includeDatabase= connectTimeout=100ms webConfig=[:9630] metricPath=/metrics"
time=2025-09-09T12:05:14.582+01:00 level=INFO msg="retrieve target url postgres://monitoring@:25018/postgres?host=/tmp from command line"
time=2025-09-09T12:05:14.583+01:00 level=INFO msg="fallback on default config path: /etc/pg_exporter.yml"
time=2025-09-09T12:05:14.603+01:00 level=DEBUG msg="load 87 queries from /etc/pg_exporter.yml, "
time=2025-09-09T12:05:14.603+01:00 level=DEBUG msg="exporter init with 87 queries"
time=2025-09-09T12:05:14.603+01:00 level=DEBUG msg="check primary server connectivity"
panic: setting PGSYSCONFDIR not supported
goroutine 1 [running]:
[github.com/lib/pq.parseEnviron.func2](http://github.com/lib/pq.parseEnviron.func2)(...)
[/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:2019](mailto:/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:2019)
[github.com/lib/pq.parseEnviron](http://github.com/lib/pq.parseEnviron)({0xc0001b7888, 0x36, 0xb0f254?})
[/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:2074](mailto:/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:2074) +0xd05
[github.com/lib/pq.NewConnector](http://github.com/lib/pq.NewConnector)({0xc00022a0a0, 0x3f})
[/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/connector.go:61](mailto:/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/connector.go:61) +0x10e
[github.com/lib/pq.DialOpen](http://github.com/lib/pq.DialOpen)({0xbf5100, 0x10a01c0}, {0xc00022a0a0?, 0xee05200ea?})
[/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:335](mailto:/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:335) +0x2c
[github.com/lib/pq.Open](http://github.com/lib/pq.Open)(...)
[/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:330](mailto:/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:330)
[github.com/lib/pq.Driver.Open](http://github.com/lib/pq.Driver.Open)({}, {0xc00022a0a0?, 0x0?})
[/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:57](mailto:/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:57) +0x2c
database/sql.dsnConnector.Connect(...)
/opt/hostedtoolcache/go/1.25.0/x64/src/database/sql/sql.go:809
database/sql.(*DB).conn(0xc000545a00, {0xbf6f28, 0xc000216770}, 0x1)
/opt/hostedtoolcache/go/1.25.0/x64/src/database/sql/sql.go:1431 +0x87d
database/sql.(*DB).query(0xc000545a00, {0xbf6f28, 0xc000216770}, {0xb13ba3, 0x18}, {0x0, 0x0, 0x0}, 0xf?)
/opt/hostedtoolcache/go/1.25.0/x64/src/database/sql/sql.go:1759 +0x57
database/sql.(*DB).QueryContext.func1(0x70?)
/opt/hostedtoolcache/go/1.25.0/x64/src/database/sql/sql.go:1742 +0x4f
database/sql.(*DB).retry(0x0?, 0xc0001118e8)
/opt/hostedtoolcache/go/1.25.0/x64/src/database/sql/sql.go:1576 +0x42
database/sql.(*DB).QueryContext(0xbf6e10?, {0xbf6f28?, 0xc000216770?}, {0xb13ba3?, 0x0?}, {0x0?, 0x0?, 0x0?})
/opt/hostedtoolcache/go/1.25.0/x64/src/database/sql/sql.go:1741 +0xc5
database/sql.(*DB).QueryRowContext(...)
/opt/hostedtoolcache/go/1.25.0/x64/src/database/sql/sql.go:1842
pg_exporter/exporter.PostgresPrecheck(0xc000498c40)
/home/runner/work/pg_exporter/pg_exporter/exporter/server.go:186 +0x1d2
pg_exporter/exporter.(*Server).Check(...)
/home/runner/work/pg_exporter/pg_exporter/exporter/server.go:101
pg_exporter/exporter.NewExporter({0xc00022a0a0, 0x3f}, {0xc000111ed8, 0xa, 0xc000222f00?})
/home/runner/work/pg_exporter/pg_exporter/exporter/exporter.go:425 +0x547
pg_exporter/[exporter.Run](http://exporter.run/)()
/home/runner/work/pg_exporter/pg_exporter/exporter/main.go:172 +0x3e5
main.main()
/home/runner/work/pg_exporter/pg_exporter/main.go:23 +0xf
$> env | grep PGSYS
PGSYSCONFDIR=/pgsql/dba/inst1/cfg
$ > unset PGSYSCONFDIR
$ > pg_exporter --url="$PG_EXPORTER_URL" --log.level=debug
time=2025-09-09T12:05:34.385+01:00 level=DEBUG msg="init pg_exporter, configPath= constLabels= disableCache=false autoDiscovery=false excludeDatabase=template0,template1,postgres includeDatabase= connectTimeout=100ms webConfig=[:9630] metricPath=/metrics"
time=2025-09-09T12:05:34.385+01:00 level=INFO msg="retrieve target url postgres://monitoring@:25018/postgres?host=/tmp from command line"
time=2025-09-09T12:05:34.385+01:00 level=INFO msg="fallback on default config path: /etc/pg_exporter.yml"
time=2025-09-09T12:05:34.409+01:00 level=DEBUG msg="load 87 queries from /etc/pg_exporter.yml, "
time=2025-09-09T12:05:34.409+01:00 level=DEBUG msg="exporter init with 87 queries"
time=2025-09-09T12:05:34.409+01:00 level=DEBUG msg="check primary server connectivity"
panic: setting PGSERVICEFILE not supported
goroutine 1 [running]:
[github.com/lib/pq.parseEnviron.func2](http://github.com/lib/pq.parseEnviron.func2)(...)
[/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:2019](mailto:/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:2019)
[github.com/lib/pq.parseEnviron](http://github.com/lib/pq.parseEnviron)({0xc0001baa88, 0x35, 0xb0f254?})
[/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:2042](mailto:/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:2042) +0xc4b
[github.com/lib/pq.NewConnector](http://github.com/lib/pq.NewConnector)({0xc0001fc000, 0x3f})
[/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/connector.go:61](mailto:/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/connector.go:61) +0x10e
[github.com/lib/pq.DialOpen](http://github.com/lib/pq.DialOpen)({0xbf5100, 0x10a01c0}, {0xc0001fc000?, 0xee05200fe?})
[/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:335](mailto:/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:335) +0x2c
[github.com/lib/pq.Open](http://github.com/lib/pq.Open)(...)
[/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:330](mailto:/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:330)
[github.com/lib/pq.Driver.Open](http://github.com/lib/pq.Driver.Open)({}, {0xc0001fc000?, 0x0?})
[/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:57](mailto:/home/runner/go/pkg/mod/github.com/lib/pq@v1.10.9/conn.go:57) +0x2c
database/sql.dsnConnector.Connect(...)
/opt/hostedtoolcache/go/1.25.0/x64/src/database/sql/sql.go:809
database/sql.(*DB).conn(0xc000433a00, {0xbf6f28, 0xc00025e3f0}, 0x1)
/opt/hostedtoolcache/go/1.25.0/x64/src/database/sql/sql.go:1431 +0x87d
database/sql.(*DB).query(0xc000433a00, {0xbf6f28, 0xc00025e3f0}, {0xb13ba3, 0x18}, {0x0, 0x0, 0x0}, 0xf?)
/opt/hostedtoolcache/go/1.25.0/x64/src/database/sql/sql.go:1759 +0x57
database/sql.(*DB).QueryContext.func1(0xf0?)
/opt/hostedtoolcache/go/1.25.0/x64/src/database/sql/sql.go:1742 +0x4f
database/sql.(*DB).retry(0x0?, 0xc0001f98e8)
/opt/hostedtoolcache/go/1.25.0/x64/src/database/sql/sql.go:1576 +0x42
database/sql.(*DB).QueryContext(0xbf6e10?, {0xbf6f28?, 0xc00025e3f0?}, {0xb13ba3?, 0x0?}, {0x0?, 0x0?, 0x0?})
/opt/hostedtoolcache/go/1.25.0/x64/src/database/sql/sql.go:1741 +0xc5
database/sql.(*DB).QueryRowContext(...)
/opt/hostedtoolcache/go/1.25.0/x64/src/database/sql/sql.go:1842
pg_exporter/exporter.PostgresPrecheck(0xc000502540)
/home/runner/work/pg_exporter/pg_exporter/exporter/server.go:186 +0x1d2
pg_exporter/exporter.(*Server).Check(...)
/home/runner/work/pg_exporter/pg_exporter/exporter/server.go:101
pg_exporter/exporter.NewExporter({0xc0001fc000, 0x3f}, {0xc0001f9ed8, 0xa, 0xc0001d6d20?})
/home/runner/work/pg_exporter/pg_exporter/exporter/exporter.go:425 +0x547
pg_exporter/[exporter.Run](http://exporter.run/)()
/home/runner/work/pg_exporter/pg_exporter/exporter/main.go:172 +0x3e5
main.main()
/home/runner/work/pg_exporter/pg_exporter/main.go:23 +0xf
$ > unset PGSERVICEFILE
Metadata
Metadata
Assignees
Labels
No labels