Skip to content

pg_up metric incorrectly remains 1 even when postgres_exporter fails to connect to the database #1120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mikezsin opened this issue Feb 6, 2025 · 1 comment

Comments

@mikezsin
Copy link

mikezsin commented Feb 6, 2025

/metrics endpoint continues to report pg_up as 1 even after the exporter loses connectivity to the PostgreSQL database.

Reproduction Steps

Start postgres_exporter normally

curl db-example-slave.example.com:9187/metrics | grep pg_up
pg_up 1

Break the Connection by Removing the ACL:
Edit pg_hba.conf and comment out the ACL entry for the postgres_exporter
Reload the PostgreSQL.

Check the pg_up metric again:
curl db-example-slave.example.com:9187/metrics | grep pg_up

Expected: pg_up should change to 0 indicating a connection failure.
Observed: pg_up remains at 1, falsely indicating that the exporter is still connected.

time=2025-02-06T23:17:10.121+03:00 level=ERROR source=collector.go:175 msg="Error opening connection to database" err="error querying postgresql version: pq: no pg_hba.conf entry for host "192.0.2.100", user "postgres_exporter", database "postgres", SSL off"

@mikezsin
Copy link
Author

mikezsin commented Feb 6, 2025

postgres_exporter v0.16.0
--collector.database_wraparound --disable-settings-metrics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant