postgres_exporter not working (PMM Server/Agent 2.5)

I use to monitor some mysql instances with no problems, but i encounter an issue with posgresql servers (12), pmm agent complains about a malformed dsn :
Apr 16 11:57:44 postgres.test postgres[81415]: [8-1] 2020-04-16 11:57:44.214 CEST [81415] LOG:  connection received: host=192.168.0.2 port=40606Apr 16 11:57:44 postgres.test postgres[81415]: [9-1] 2020-04-16 11:57:44.216 CEST [81415] LOG:  connection authorized: user=pmm_user database=postgresApr 16 11:57:44 postgres.test pmm-agent: #033[36mINFO#033[0m[2020-04-16T11:57:44.223+02:00] time=“2020-04-16T11:57:44+02:00” level=info msg=“Starting postgres_exporter (version=, branch=, revision=)” source=“postgres_exporter.go:1457”  #033[36magentID#033[0m=/agent_id/68a5e0df-8eac-46c7-a740-831450a3e5f4 #033[36mcomponent#033[0m=agent-process #033[36mtype#033[0m=postgres_exporterApr 16 11:57:44 postgres.test pmm-agent: #033[36mINFO#033[0m[2020-04-16T11:57:44.223+02:00] time=“2020-04-16T11:57:44+02:00” level=info msg=“Build context (go=go1.13.8, user=, date=)” source=“postgres_exporter.go:1458”  #033[36magentID#033[0m=/agent_id/68a5e0df-8eac-46c7-a740-831450a3e5f4 #033[36mcomponent#033[0m=agent-process #033[36mtype#033[0m=postgres_exporterApr 16 11:57:44 postgres.test pmm-agent: #033[36mINFO#033[0m[2020-04-16T11:57:44.223+02:00] time=“2020-04-16T11:57:44+02:00” level=error msg=“Error opening connection to database (postgres://pmm_user:PASSWORD_REMOVED@192.168.0.2:5432/postgres?connect_timeout=1&sslmode=disable): malformed dsn “connect_timeout=1 dbname=postgres host=192.168.0.2 password=*** port=5432 sslmode=disable user=pmm_user”” source=“postgres_exporter.go:1396”  #033[36magentID#033[0m=/agent_id/68a5e0df-8eac-46c7-a740-831450a3e5f4 #033[36mcomponent#033[0m=agent-process #033[36mtype#033[0m=postgres_exporter

RépondreTransférer

Hi Alex,
It looks like the issue is related to a wrong credential. Could you check postgres logs?

We have tested pmm client with the latest PostgreSQL.
# /usr/local/pgsql/bin/psql -Vpsql (PostgreSQL) 12.2
#
[root@ip-10-178-2-25 ec2-user]# pmm-admin add postgresql --username=“ec2-user” --port=5433 postgres-12.2PostgreSQL Service added.Service ID  : /service_id/b578e924-c4e2-466a-ab21-23ff24d46ebdService name: postgres-12.2# pmm-admin list | grep postgres-12.2

PostgreSQL    postgres-12.2        127.0.0.1:5433    /service_id/b578e924-c4e2-466a-ab21-23ff24d46ebd

pmm-admin list shows me a connected status for agent and a runnning status for all exporters.
In the logs i previously posted :
Apr 16 11:57:44 postgres.test postgres[81415]: [8-1] 2020-04-16 11:57:44.214 CEST [81415] LOG:  connection received: host=192.168.0.2 port=40606Apr 16 11:57:44 postgres.test postgres[81415]: [9-1] 2020-04-16 11:57:44.216 CEST [81415] LOG:  connection authorized: user=pmm_user database=postgres
So it does not seem to be a credential problem.
Ty.

Are you able to establish a connection by using the connection URI from logs?
e.g.
# /usr/local/pgsql/bin/psql -Atx “postgres://pmm_user:PASSWORD@localhost:5433/postgres?connect_timeout=1&sslmode=disable” -c ‘select current_date’

current_date|2020-04-22


Yes it is working, i can establish a connection by using the connection URI from logs. But i cant check the password effectively sent as it appears as PASSWORD_REMOVED in the logs.

Hi Alex,
Could you raise a bug report in our Jira system with all related information? It’s required to reproduce the issue on our side.

Done.
https://jira.percona.com/browse/PMM-5837