Skip to content

Unable to get metrics from databases #1130

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
Yeroha opened this issue Feb 23, 2025 · 5 comments
Open

Unable to get metrics from databases #1130

Yeroha opened this issue Feb 23, 2025 · 5 comments

Comments

@Yeroha
Copy link

Yeroha commented Feb 23, 2025

What did you do?
I installed postgres_exporter 0.16.0 linux. I have 2 databases: test_db_1, test_db_2. Trying get metrics from tables pg_stat_user_tables for my databases, but i see metrics from only postgres DB. Inserted --auto-discover-databases to config file, but not working. User postgres_exporter has privileges on these databases
Why i'm not see metrics from DBs?

  • postgres_exporter version:

    0.16.0

  • PostgreSQL version:

    16.7.1

@scottishwidow
Copy link

scottishwidow commented Mar 21, 2025

@Yeroha hey!👋

According to the Flags section of the README, the --auto-discover-databases flag has been deprecated.

You might want to consider using the --extend.query-path option with a custom queries file instead.

@rhclayto
Copy link

rhclayto commented Apr 11, 2025

--extend.query-path is also listed as DEPRECATED.

Adding new metrics via a config file (DEPRECATED)

This feature is deprecated in favor of built-in collector functions. For generic SQL database monitoring see the sql_exporter.

The -extend.query-path command-line argument specifies a YAML file containing additional queries to run. Some examples are provided in queries.yaml.

@DaveK-KNIME
Copy link

I'm having the same problem. I tried adding all DBs as individual data source names, which gives me errors about duplicate metrics. The --auto-discover-databases also does not seem to do anything for me. How should this be configured such that the pg_stat_user_tables are scraped for all DBs?

@HannesLindback
Copy link

I also have the same issue. Running postgres_exporter ----collector.stat_user_tables the metrics endpoint states that the scrape has succeeded but no metrics from the scrape is available:

pg_scrape_collector_duration_seconds{collector="stat_user_tables"} 0.007558851
pg_scrape_collector_success{collector="stat_user_tables"} 1

Other collectors seem to work without issue.

  • Postgres-exporter version: 0.17.1
  • Postgresql version: 17.5

@DaveK-KNIME
Copy link

DaveK-KNIME commented Jun 5, 2025

My workaround is to use the (deprecated) custom queries feature (e.g. the queries from here). Together with --auto-discover-databases this gives me the metrics for the user tables for all DBs.

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

5 participants