Skip to content

No errors/info at logs, when probe_success 0 #713

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

Closed
KES777 opened this issue Oct 28, 2022 · 4 comments
Closed

No errors/info at logs, when probe_success 0 #713

KES777 opened this issue Oct 28, 2022 · 4 comments

Comments

@KES777
Copy link

KES777 commented Oct 28, 2022

What did you do?

version: '3.8'

services:
  postgres-exporter:
    image: quay.io/prometheuscommunity/postgres-exporter:master
    command: [
      "--config.file", "/etc/postgres-exporter.yml",
      "--log.level", "debug",
      "--disable-default-metrics",
    ]
    volumes:
      - ${STACK_ROOT}/postgres-exporter.yml:/etc/postgres-exporter.yml
    environment:
      DATA_SOURCE_NAME: "postgresql://postgres:xxx@db:5432/postgres?sslmode=disable,postgresql://postgres:password@tsdb:5432/postgres?sslmode=disable"
      PG_EXPORTER_AUTO_DISCOVER_DATABASES: "false"
      PG_EXPORTER_EXCLUDE_DATABASES: "template0,template1"
      PG_EXPORTER_CONSTANT_LABELS: "dbcluster=pgdb"
# cat postgres-exporter.yml 
auth_modules:
  pgdb:
    type: userpass
    userpass:
      username: postgres
      password: xxx
    options:
      # options become key=value parameters of the DSN
      sslmode: disable

  tsdb:
    type: userpass
    userpass:
      username: postgres
      password: password
    options:
      # options become key=value parameters of the DSN
      sslmode: disable

What did you expect to see?
I expect some errors are reported.

What did you see instead? Under which circumstances?
I do not see any errors at logs.

Environment

  • System information: Docker compose
  • postgres_exporter version: 0.12.0
  • postgres_exporter flags:
"--config.file", "/etc/postgres-exporter.yml",
"--log.level", "debug",
"--disable-default-metrics",

When I did the query:
http://host:9187/probe?target=tsdb:5432&auth_module=tsdd

auth_module tsdd not found

This is expected, because tsdd was not configured.

http://host:9187/probe?target=xxtsdb:5432&auth_module=tsdb
I see this output:

# HELP pg_scrape_collector_duration_seconds postgres_exporter: Duration of a collector scrape.
# TYPE pg_scrape_collector_duration_seconds gauge
pg_scrape_collector_duration_seconds{collector="bgwriter"} 0.011608647
pg_scrape_collector_duration_seconds{collector="database"} 0.010288506
# HELP pg_scrape_collector_success postgres_exporter: Whether a collector succeeded.
# TYPE pg_scrape_collector_success gauge
pg_scrape_collector_success{collector="bgwriter"} 0
pg_scrape_collector_success{collector="database"} 0
# HELP probe_duration_seconds Returns how long the probe took to complete in seconds
# TYPE probe_duration_seconds gauge
probe_duration_seconds 5.5028e-05
# HELP probe_success Displays whether or not the probe was a success
# TYPE probe_success gauge
probe_success 0

I expect here some error instead of prometheus metrics. Or, at least, some errors at log file.
There should be error that xxtsdb:5432 does not exists/not configured/no connection.

When I query:
http://172.22.22.15:9187/probe?target=tsdb:5432/postgres&auth_module=tsdb
or
http://172.22.22.15:9187/probe?target=tsdb:5432&auth_module=tsdb

# HELP pg_database_size_bytes Disk space used by the database
# TYPE pg_database_size_bytes gauge
pg_database_size_bytes{datname="postgres"} 1.637802787e+09
pg_database_size_bytes{datname="template0"} 8.602115e+06
pg_database_size_bytes{datname="template1"} 1.1125251e+07
# HELP pg_scrape_collector_duration_seconds postgres_exporter: Duration of a collector scrape.
# TYPE pg_scrape_collector_duration_seconds gauge
pg_scrape_collector_duration_seconds{collector="bgwriter"} 0.331756757
pg_scrape_collector_duration_seconds{collector="database"} 0.275337993
# HELP pg_scrape_collector_success postgres_exporter: Whether a collector succeeded.
# TYPE pg_scrape_collector_success gauge
pg_scrape_collector_success{collector="bgwriter"} 1
pg_scrape_collector_success{collector="database"} 1
# HELP pg_stat_bgwriter_buffers_alloc_total Number of buffers allocated
# TYPE pg_stat_bgwriter_buffers_alloc_total counter
pg_stat_bgwriter_buffers_alloc_total 506044
# HELP pg_stat_bgwriter_buffers_backend_fsync_total Number of times a backend had to execute its own fsync call (normally the background writer handles those even when the backend does its own write)
# TYPE pg_stat_bgwriter_buffers_backend_fsync_total counter
pg_stat_bgwriter_buffers_backend_fsync_total 0
# HELP pg_stat_bgwriter_buffers_backend_total Number of buffers written directly by a backend
# TYPE pg_stat_bgwriter_buffers_backend_total counter
pg_stat_bgwriter_buffers_backend_total 469537
# HELP pg_stat_bgwriter_buffers_checkpoint_total Number of buffers written during checkpoints
# TYPE pg_stat_bgwriter_buffers_checkpoint_total counter
pg_stat_bgwriter_buffers_checkpoint_total 1.639138e+06
# HELP pg_stat_bgwriter_buffers_clean_total Number of buffers written by the background writer
# TYPE pg_stat_bgwriter_buffers_clean_total counter
pg_stat_bgwriter_buffers_clean_total 0
# HELP pg_stat_bgwriter_checkpoint_sync_time_total Total amount of time that has been spent in the portion of checkpoint processing where files are synchronized to disk, in milliseconds
# TYPE pg_stat_bgwriter_checkpoint_sync_time_total counter
pg_stat_bgwriter_checkpoint_sync_time_total 40829
# HELP pg_stat_bgwriter_checkpoint_write_time_total Total amount of time that has been spent in the portion of checkpoint processing where files are written to disk, in milliseconds
# TYPE pg_stat_bgwriter_checkpoint_write_time_total counter
pg_stat_bgwriter_checkpoint_write_time_total 9.4221717e+07
# HELP pg_stat_bgwriter_checkpoints_req_total Number of requested checkpoints that have been performed
# TYPE pg_stat_bgwriter_checkpoints_req_total counter
pg_stat_bgwriter_checkpoints_req_total 1
# HELP pg_stat_bgwriter_checkpoints_timed_total Number of scheduled checkpoints that have been performed
# TYPE pg_stat_bgwriter_checkpoints_timed_total counter
pg_stat_bgwriter_checkpoints_timed_total 118
# HELP pg_stat_bgwriter_maxwritten_clean_total Number of times the background writer stopped a cleaning scan because it had written too many buffers
# TYPE pg_stat_bgwriter_maxwritten_clean_total counter
pg_stat_bgwriter_maxwritten_clean_total 0
# HELP pg_stat_bgwriter_stats_reset_total Time at which these statistics were last reset
# TYPE pg_stat_bgwriter_stats_reset_total counter
pg_stat_bgwriter_stats_reset_total 1.666883095e+09
# HELP probe_duration_seconds Returns how long the probe took to complete in seconds
# TYPE probe_duration_seconds gauge
probe_duration_seconds 0.000113717
# HELP probe_success Displays whether or not the probe was a success
# TYPE probe_success gauge
probe_success 0

Still probe_success 0 and no any reports about errors at log file =(

@KES777
Copy link
Author

KES777 commented Oct 28, 2022

Also there is no any errors when I provide incorrect database name cc:
http://172.22.22.15:9187/probe?target=db:5432/cc&auth_module=pgdb

# HELP pg_scrape_collector_duration_seconds postgres_exporter: Duration of a collector scrape.
# TYPE pg_scrape_collector_duration_seconds gauge
pg_scrape_collector_duration_seconds{collector="bgwriter"} 0.028025201
pg_scrape_collector_duration_seconds{collector="database"} 0.046365659
# HELP pg_scrape_collector_success postgres_exporter: Whether a collector succeeded.
# TYPE pg_scrape_collector_success gauge
pg_scrape_collector_success{collector="bgwriter"} 0
pg_scrape_collector_success{collector="database"} 0
# HELP probe_duration_seconds Returns how long the probe took to complete in seconds
# TYPE probe_duration_seconds gauge
probe_duration_seconds 0.000192409
# HELP probe_success Displays whether or not the probe was a success
# TYPE probe_success gauge
probe_success 0

probe_success 0 is not informative. I expect to see something at container log, at least GET /probe...

@kjbass
Copy link
Contributor

kjbass commented Nov 17, 2022

I could be completely off base, but I believe the probe_sucess field is actually never set to success. Take a peek at this code here. Potentially worthy of a new issue in its own right, though.

@sysadmind
Copy link
Contributor

The probe_success field should be set now. This should be resolved with #724

@KES777
Copy link
Author

KES777 commented Nov 28, 2022

@sysadmind Hi, thanks for improvement. But I do not see any informative messages at logs after that fix =(

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

3 participants