prometheus-community / postgres_exporter

A PostgreSQL metric exporter for Prometheus
Apache License 2.0
2.83k stars 745 forks source link

Postgres Exporter Metric Missing #990

Open paldapd opened 11 months ago

paldapd commented 11 months ago

Hello, I'm creating a dashboard database using Postgres Exporter, Prometheus, and Grafana. But it seems the database is not connected to the grafana dashboard because there is no data and the database not appear on dashboard. Then i check Prometheus, there is no query for pg_stat? The only queries available are pg_exporter_last_scrape_duration_seconds, pg_up, pg_exporter_last_scrape_error, pg_exporter_scrapes_total. So basically, I'm missing some metrics from the PostgreSQL exporter. Then i check debugs logs and showing like this Can anyone help me on how to resolve this? Thank you

docker logs -f e1a02e402ab7 ts=2023-12-28T01:27:48.486Z caller=main.go:86 level=warn msg="Error loading config" err="Error opening config file \"postgres_exporter.yml\": open postgres_exporter.yml: no such file or directory" ts=2023-12-28T01:27:48.486Z caller=proc.go:267 msg="Excluded databases" databases=[] ts=2023-12-28T01:27:48.487Z caller=tls_config.go:274 level=info msg="Listening on" address=[::]:9187 ts=2023-12-28T01:27:48.487Z caller=tls_config.go:277 level=info msg="TLS is disabled." http2=false address=[::]:9187 ts=2023-12-28T01:27:51.616Z caller=collector.go:176 level=error msg="Error opening connection to database" err="error querying postgresql version: dial tcp 127.0.0.1:5432: connect: connection refused" ts=2023-12-28T01:27:52.613Z caller=postgres_exporter.go:682 level=error err="Error opening connection to database (postgresql://postgres:PASSWORD_REMOVED@localhost:5432/%20postgres?sslmode=disable): malformed dsn \"dbname=' postgres' host='localhost' password='pswr' port='5432' sslmode='disable' user='postgres'\"" ts=2023-12-28T01:28:06.613Z caller=collector.go:176 level=error msg="Error opening connection to database" err="error querying postgresql version: dial tcp 127.0.0.1:5432: connect: connection refused"

frenkye commented 11 months ago

Read your logs, if you can't connect to your PSQL instance, then you can't have metrics.

ts=2023-12-28T01:27:51.616Z caller=collector.go:176 level=error msg="Error opening connection to database" err="error querying postgresql version: dial tcp 127.0.0.1:5432: connect: connection refused"

  • Your connection was refused, so fix your credetials for connection. Also check for firewall, hba.conf setting, etc.

    ts=2023-12-28T01:27:48.486Z caller=main.go:86 level=warn msg="Error loading config" err="Error opening config file "postgres_exporter.yml": open postgres_exporter.yml: no such file or directory"

  • You are missing your config file, which should not be deal breaker