prometheus-community / postgres_exporter

A PostgreSQL metric exporter for Prometheus
Apache License 2.0
2.8k stars 738 forks source link

Multi target and 5xx #917

Open linuxmanju opened 1 year ago

linuxmanju commented 1 year ago

What did you do?

Configured latest stable release of postgres_exporter, Created an auth module.

auth_modules:
  foo1: # Set this to any name you want
    type: userpass
    userpass:
      username: 'USN'
      password: 'pass@123'
    options:
      # options become key=value parameters of the DSN
      sslmode: disable

Promtheus scrape job

 - job_name: 'postgres-gcp-sd'
    static_configs:
      - targets:
        - 10.180.56.18:5432
          #gce_sd_configs:
          # - project: josh-prod-392409
          # zone: asia-south1-b
          # port: 5432
    metrics_path: /probe
    params:
        auth_module: [foo1]
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 10.180.191.203:6262

What did you expect to see?

Scrape to happen successfully with metrics being available in prometheus.

What did you see instead? Under which circumstances?

server returned HTTP status 500 Internal Server Error

Environment

prod

Linux 5.10.0-23-cloud-amd64 x86_64

 postgres_exporter  --config.file=/tmp/pg.conf  --log.level=debug --web.listen-address=:6262

14.0

sysadmind commented 1 year ago

The only scenario that should throw a 500 on the /probe endpoint is if we fail to create the collector. In that case, the error should be in the response body. Can you query the probe URL and see what the output is?

I opened #918 to also log this error.