Description
/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"