Adding postgres instance failing with error

[root@dbhost pmm-client]# pmm-admin add postgresql:metrics --user pmm --password ‘password’ --host dbhost --port 5432
Error adding PostgreSQL metrics: Cannot connect to PostgreSQL:

  • dial tcp: address tcp/zKF: unknown port

User pmm is created on postgres database using below commands

CREATE USER “pmm” WITH PASSWORD ‘password’;
ALTER USER “pmm” SET SEARCH_PATH TO “pmm”,pg_catalog;
CREATE SCHEMA “pmm” AUTHORIZATION “pmm”;
CREATE OR REPLACE VIEW “pmm”.pg_stat_activity AS SELECT * from pg_catalog.pg_stat_activity;
GRANT SELECT ON “pmm”.pg_stat_activity TO “pmm”;
CREATE OR REPLACE VIEW “pmm”.pg_stat_replication AS SELECT * from pg_catalog.pg_stat_replication;
GRANT SELECT ON “pmm”.pg_stat_replication TO “pmm”;

PMM Version : 1.4.1

Adding an account with user “postgres” works fine.

[root@dbhost pmm-client]# pmm-admin add postgresql:metrics --user postgres --password ‘password’ --host dbhost --port 5432

OK, now monitoring PostgreSQL metrics using DSN postgresql:***@dbhost:5432/postgres

Hi sureshr7

I’m going to see if I can get an engineer to look at this report and see if you’ve uncovered a bug. We’ll update the thread, thanks!

Hi sureshr7
Thank you for the report! I’ve tried to reproduce the problem, but everything works ok:

root@bm-dell02-qanqa01:/home/nailya.kutlubaeva# pmm-admin add postgresql:metrics --user pmm --password ‘password’ --host=localhost --port=5432
OK, now monitoring PostgreSQL metrics using DSN postgresql:***@localhost:5432/postgres

Which version of PostgreSQL do you use?

Postgres Version : 10.5.1

Is there any additional debug option to troubleshoot this? Tried with verbose and not much help.

Found the problem with password with special characters. After removing pmm user worked fine. Just a bad error message.

Hi sureshr7
Good find! What was the special character in particular?

I reported it as [url][PMM-3039] pmm-admin add postgresql fails when special character present in password - Percona JIRA

We’ll test a variety of characters, but if you can confirm which one(s) you used, that would be helpful! Thanks,

I had “?-” as special characters. I have passed within single quotes. Still failed.