Dial tcp 127.0.0.1:7777: connect: connection refused

Hello Team,

I am facing below error while adding PostgreSQL service to PMM.

FYI: PMM SERVER & PMM CLIENT & PostgreSQL all are on the same machine. [Purpose to do this is that while adding PostgreSQL service remotely, the pg_stat_monitor from query analytics is not used.]

root@DESKTOP-L0E2A77:/etc/mysql/mysql.conf.d# pmm-admin add postgresql --username=pmm --server-url=https://admin:admin@172.21.226.127:443 --query-source=pgstatmonitor --server-insecure-tls --debug --password=PASSWORD
Output

DEBUG 2023-03-20 08:09:46.554810841Z: POST /local/Status HTTP/1.1
Host: 127.0.0.1:7777
User-Agent: Go-http-client/1.1
Content-Length: 3
Accept: application/json
Content-Type: application/json
Accept-Encoding: gzip

{}

DEBUG 2023-03-20 08:09:46.555006834Z: Result: <nil>
DEBUG 2023-03-20 08:09:46.555035567Z: Error: &url.Error{Op:"Post", URL:"http://127.0.0.1:7777/local/Status", Err:(*net.OpError)(0xc00048c780)}
Post "http://127.0.0.1:7777/local/Status": dial tcp 127.0.0.1:7777: connect: connection refused
root@DESKTOP-L0E2A77:/etc/mysql/mysql.conf.d#

If PMM is on the same machine (which is not recommended), then the server-url should be 127.0.0.1

What’s running on 7777? Or rather, what should be? Whatever should be here is not running and thus the PMM agent cannot connect.

Thank you @matthewb for response !

There is nothing running on port 7777

root@DESKTOP-L0E2A77:~# lsof -i -P -n | grep LISTEN
postgres  1301 postgres    5u  IPv4  18121      0t0  TCP *:5432 (LISTEN)
postgres  1301 postgres    6u  IPv6  18122      0t0  TCP *:5432 (LISTEN)
docker-pr 2489     root    4u  IPv4  24782      0t0  TCP *:443 (LISTEN)
docker-pr 2496     root    4u  IPv6  23802      0t0  TCP *:443 (LISTEN)
root@DESKTOP-L0E2A77:~# lsof -i -P -n | grep 7777
root@DESKTOP-L0E2A77:~#  pmm-admin add mysql  --username=pmm  --server-url=https://admin:admin@127.0.0.1:443 --debug --password=Mutual#ubuntu
DEBUG 2023-03-21 02:43:04.983117531Z: POST /local/Status HTTP/1.1
Host: 127.0.0.1:7777
User-Agent: Go-http-client/1.1
Content-Length: 3
Accept: application/json
Content-Type: application/json
Accept-Encoding: gzip

{}

DEBUG 2023-03-21 02:43:04.983269148Z: Result: <nil>
DEBUG 2023-03-21 02:43:04.983295195Z: Error: &url.Error{Op:"Post", URL:"http://127.0.0.1:7777/local/Status", Err:(*net.OpError)(0xc00058f310)}
Post "http://127.0.0.1:7777/local/Status": dial tcp 127.0.0.1:7777: connect: connection refused
root@DESKTOP-L0E2A77:~#

Exactly. There should be something running on 7777 which is why you are getting that error. But whatever should be running there, is not running.

Strange thing how would I solve it then :thinking:

Looks like the pmm-agent runs on 7777. Is the agent running? (probably not since there’s nothing on 7777) Did you start the agent and register this client with the server?

root@DESKTOP-L0E2A77:/var/lib/docker# docker exec pmm-client \
> pmm-admin status
Error response from daemon: No such container: pmm-client
root@DESKTOP-L0E2A77:/var/lib/docker# pmm-admin --version
ProjectName: pmm-admin
Version: 2.35.0
PMMVersion: 2.35.0
Timestamp: 2023-02-22 07:41:41 (UTC)
FullCommit: 5e80fd1f3fdddbae98002e819e9396043b7a9740
root@DESKTOP-L0E2A77:/var/lib/docker#

Please read the documentation for setting up the PMM Client. This is a critical step that you seemed to have missed. This is not done via docker but installed onto the operating system via your OS’s package manager.