prometheus-community / prometheus-community/postgres_exporter

can not connect to psql when using `DATA_SOURCE_URI_FILE` or `DATA_SOURCE_URI`

Open
#501 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
3.6k
Forks
835
Avg merge
2d 4h
Merged PRs (30d)
10

Description

What's working and not:

When I use the URI in DATA_SOURCE_NAME it's connecting to pgsql fine. But when I put the URI in either DATA_SOURCE_URI_FILE or DATA_SOURCE_URI it's trying to connect to 67.207.67.2:53.

content in URI_FILE

postgresql://postgres:myPassword@127.0.0.1:5432/postgres?sslmode=disable

Error Log:

level=error ts=2021-03-12T17:01:04.887Z caller=postgres_exporter.go:1622 err="Error opening connection to database (postgresql://:PASSWORD_REMOVED@postgresql://postgres:myPassword@127.0.0.1:5432/postgres?sslmode=disable): dial tcp: lookup postgresql on 67.207.67.2:53: dial udp 67.207.67.2:53: connect: network is unreachable"

Expected result:

I need to connect my psql using URI file or any other cmds without exposing the password

(p.s: psql server is not connected to the internet)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the connection error reported at postgres_exporter.go:1622 and compare how DATA_SOURCE_NAME, DATA_SOURCE_URI_FILE, and DATA_SOURCE_URI are parsed. Reproduce the configuration with the provided PostgreSQL URI and verify that URI-based settings connect without duplicating the URI or exposing the password.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.