prometheus-community / postgres_exporter

A PostgreSQL metric exporter for Prometheus
Apache License 2.0
2.73k stars 725 forks source link

Metric URL not accessable #732

Open phionachao opened 1 year ago

phionachao commented 1 year ago

What did you do? Installed Postgres_Exporter with 9187 but not accessible

What did you expect to see? expected to see metric from URL What did you see instead? Under which circumstances? unreachable

Environment

insert list of flags used here
zeusng-fast commented 1 year ago

Running Postgres Exporter against 2 x instances in a Kubernetes Statefulset.

We experience the same issue. Our initial tests indicate that.

  1. If postgres_exporter is pointing to multiple postgres instances (e.g. postgresql://postgres:xxx@instance-0.mynamespace.svc/postgres,postgresql://postgres:xxx@instance-1.mynamespace.svc/postgres) this problem will occur
  2. If postgres_exporter is pointing to only one instance, there is no problem.

The same connection url with multiple instances works in release v0.10.x and below.

sh-4.4$ curl -v http://10.129.5.188:9187/metrics

4 error(s) occurred:

Similar problem is affecting pgbouncer exporter as well. https://github.com/prometheus-community/pgbouncer_exporter/issues/47

Wonder if this is a problem with the Prometheus library or the new connector implementation in general.

phionachao commented 1 year ago

Running Postgres Exporter against 2 x instances in a Kubernetes Statefulset.

We experience the same issue. Our initial tests indicate that.

  1. If postgres_exporter is pointing to multiple postgres instances (e.g. postgresql://postgres:xxx@instance-0.mynamespace.svc/postgres,postgresql://postgres:xxx@instance-1.mynamespace.svc/postgres) this problem will occur
  2. If postgres_exporter is pointing to only one instance, there is no problem.

The same connection url with multiple instances works in release v0.10.x and below.

sh-4.4$ curl -v http://10.129.5.188:9187/metrics

  • Trying 10.129.5.188...
  • TCP_NODELAY set
  • Connected to 10.129.5.188 (10.129.5.188) port 9187 (#0)

GET /metrics HTTP/1.1 Host: 10.129.5.188:9187 User-Agent: curl/7.61.1 Accept: /

< HTTP/1.1 500 Internal Server Error < Content-Type: text/plain; charset=utf-8 < X-Content-Type-Options: nosniff < Date: Thu, 15 Dec 2022 03:02:40 GMT < Content-Length: 785 < An error has occurred while serving metrics:

4 error(s) occurred:

  • collected metric "pg_scrape_collector_duration_seconds" { label:<name:"collector" value:"bgwriter" > gauge: } was collected before with the same name and label values
  • collected metric "pg_scrape_collector_success" { label:<name:"collector" value:"bgwriter" > gauge: } was collected before with the same name and label values
  • collected metric "pg_scrape_collector_duration_seconds" { label:<name:"collector" value:"database" > gauge: } was collected before with the same name and label values
  • collected metric "pg_scrape_collector_success" { label:<name:"collector" value:"database" > gauge: } was collected before with the same name and label values
  • Connection #0 to host 10.129.5.188 left intact

Similar problem is affecting pgbouncer exporter as well. prometheus-community/pgbouncer_exporter#47

Wonder if this is a problem with the Prometheus library or the new connector implementation in general.

I'm just trying to get the metrics from single postgres instance, while i tried to startup the postgres_exporter below the collector cannot be created

"ts=2022-12-29T09:39:40.145Z caller=main.go:124 level=error msg="Failed to create PostgresCollector" err="malformed dsn \"\"""

Just wondering if there is any where i have missed