Skip to content
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

Postgres Exporter Metric Missing #990

Open
paldapd opened this issue Dec 28, 2023 · 1 comment
Open

Postgres Exporter Metric Missing #990

paldapd opened this issue Dec 28, 2023 · 1 comment

Comments

@paldapd
Copy link

paldapd commented Dec 28, 2023

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
Copy link

frenkye commented Dec 29, 2023

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

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

2 participants