# Adding server by hostname instead of IP ok?

**URL:** <https://forums.percona.com/t/adding-server-by-hostname-instead-of-ip-ok/5255>\
**Category:** PMM 1.x\
**Created:** [December 5, 2016, 12:58am UTC](https://forums.percona.com/t/adding-server-by-hostname-instead-of-ip-ok/5255 "2016-12-05T00:58:03Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasbar](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jasbar](https://forums.percona.com/u/jasbar)\
**Post date:** [December 5, 2016, 12:58am UTC](https://forums.percona.com/t/adding-server-by-hostname-instead-of-ip-ok/5255/1 "2016-12-05T00:58:03Z")

</div>

Is using a hostname supported instead of an ip? We have a mesos/marathon deploy so the server container does not have a dedicated ip, rather it is routed via haproxy. I can browse the server container fine but when I try and add via the client I get.

Unable to connect to PMM server by address: pmm-server.prdmesos..com

Even though the server is reachable it does not look to be PMM server.  
Check if the configured address is correct.

I can also ping that address on pmm-server.prdmesos..com

$ ping pmm-server.prdmesos..com  
PING pmm-server.prdmesos..com (10.1.202.165) 56(84) bytes of data.

Any ideas?

---

<div class="post-metadata">

**Author:** ![weber](https://avatars.discourse-cdn.com/v4/letter/w/da6949/32.png) [@weber](https://forums.percona.com/u/weber)\
**Post date:** [December 5, 2016, 4:51am UTC](https://forums.percona.com/t/adding-server-by-hostname-instead-of-ip-ok/5255/2 "2016-12-05T04:51:42Z")

</div>

Yes, hostname is supported as client address.  
To access PMM server, you should be able to connect to pmm-server.prdmesos..com on port 80 (default, if not changed) from the client side.

---

<div class="post-metadata">

**Author:** ![jasbar](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jasbar](https://forums.percona.com/u/jasbar)\
**Post date:** [December 5, 2016, 5:31pm UTC](https://forums.percona.com/t/adding-server-by-hostname-instead-of-ip-ok/5255/3 "2016-12-05T17:31:10Z")

</div>

Any idea why this wouldn’t work then, any tips for what we should check? We can browse the site on port 80 in a browser as well as curl, but when trying to add to the client we get the error

```auto
Unable to connect to PMM server by address: pmm-server.prdmesos.<redacted>.com

Even though the server is reachable it does not look to be PMM server.
Check if the configured address is correct.

```

![photoid=46571](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/2/238a11acf04e796c948486519a7b5bf370c985ea.jpeg)

---

<div class="post-metadata">

**Author:** ![weber](https://avatars.discourse-cdn.com/v4/letter/w/da6949/32.png) [@weber](https://forums.percona.com/u/weber)\
**Post date:** [December 6, 2016, 2:47am UTC](https://forums.percona.com/t/adding-server-by-hostname-instead-of-ip-ok/5255/4 "2016-12-06T02:47:36Z")

</div>

What command do you run?  
pmm-admin config --server pmm-server.prdmesos..com?

Try:  
curl [http://pmm-server.prdmesos](http://pmm-server.prdmesos)..com/v1/status/leader

You should get “127.0.0.1:8300”.

Note, the server should respond via curl by various paths: /prometheus /v1 /qan-api  
For UI, these are: /graph /qan /orchestrator

---

<div class="post-metadata">

**Author:** ![shib71](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@shib71](https://forums.percona.com/u/shib71)\
**Post date:** [December 6, 2016, 6:17pm UTC](https://forums.percona.com/t/adding-server-by-hostname-instead-of-ip-ok/5255/5 "2016-12-06T18:17:41Z")

</div>

Hi, I’m working with jasbar on this. We do get responses on /v1/status/leader, /prometheus/, /v1, /qan, but /qan-api, /graph, /orchestrator don’t respond. I’ve taken a look at some of the the logs in the container, and it looks like there are permission issues with the volumes.

I suspect that there is an issue with the fact that I have set up pmm-server to use normal host volumes instead a persistent data container. Do any of you have experience with this?

---

<div class="post-metadata">

**Author:** ![weber](https://avatars.discourse-cdn.com/v4/letter/w/da6949/32.png) [@weber](https://forums.percona.com/u/weber)\
**Post date:** [December 7, 2016, 5:04am UTC](https://forums.percona.com/t/adding-server-by-hostname-instead-of-ip-ok/5255/6 "2016-12-07T05:04:02Z")

</div>

The volumes should be initialized by the image. So empty ones do not work.  
It works for Prometheus, Consul but not for Grafana, QAN API, Orchestrator where mysql datadir should be initialized and loaded.

---

<div class="post-metadata">

**Author:** ![jasbar](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jasbar](https://forums.percona.com/u/jasbar)\
**Post date:** [December 7, 2016, 9:18pm UTC](https://forums.percona.com/t/adding-server-by-hostname-instead-of-ip-ok/5255/7 "2016-12-07T21:18:17Z")

</div>

So we have the server responding now but when we try and add:

sudo pmm-admin add mysql:queries --user root --password 123 --query-source=perfschema

We get:

Error adding MySQL queries: timeout 10s waiting on agent to connect to API.

Checking logs we can see:

2016/12/08 13:38:46.021689 main.go:165: Starting agent…  
2016/12/08 13:38:46.022273 main.go:343: Agent is ready  
2016/12/08 13:38:46.029994 main.go:207: API is ready  
2016/12/08 13:38:47.025344 WARNING log-ws read tcp 192.168.68.16:60127-\>10.1.202.165:80: read: connection reset by peer  
2016/12/08 13:38:47.025466 WARNING agent-ws read tcp 192.168.68.16:60126-\>10.1.202.165:80: read: connection reset by peer  
2016/12/08 13:38:50.027019 WARNING agent-ws read tcp 192.168.68.16:60129-\>10.1.202.165:80: read: connection reset by peer  
2016/12/08 13:38:50.027076 WARNING log-ws read tcp 192.168.68.16:60128-\>10.1.202.165:80: read: connection reset by peer  
2016/12/08 13:38:57.028584 WARNING agent-ws read tcp 192.168.68.16:60130-\>10.1.202.165:80: read: connection reset by peer  
2016/12/08 13:38:57.028670 WARNING log-ws read tcp 192.168.68.16:60131-\>10.1.202.165:80: read: connection reset by peer  
2016/12/08 13:39:12.030263 WARNING agent-ws read tcp 192.168.68.16:60132-\>10.1.202.165:80: read: connection reset by peer  
2016/12/08 13:39:12.030314 WARNING log-ws read tcp 192.168.68.16:60133-\>10.1.202.165:80: read: connection reset by peer  
2016/12/08 13:39:43.031821 WARNING agent-ws read tcp 192.168.68.16:60135-\>10.1.202.165:80: read: connection reset by peer  
2016/12/08 13:39:43.031869 WARNING log-ws read tcp 192.168.68.16:60136-\>10.1.202.165:80: read: connection reset by peer

In our marathon/mesos setting the connection has to be by hostname and not ip otherwise it won’t route to the correct container. Does this mean it needs a dedicated IP after all?

sudo pmm-admin list  
pmm-admin 1.0.6

PMM Server | pmm-server.prdmesos..com  
Client Name | prdmesos-db01.  
Client Address | 192.168.101.8  
Service manager | linux-systemd

* * *

SERVICE TYPE NAME CLIENT PORT RUNNING DATA SOURCE OPTIONS

* * *

linux:metrics prdmesos-db01. 42000 NO -  
mysql:metrics prdmesos-db01. 42002 NO root:\*\*\*@unix(/var/lib/mysql/mysql.sock) tablestats=OFF

---

<div class="post-metadata">

**Author:** ![jasbar](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jasbar](https://forums.percona.com/u/jasbar)\
**Post date:** [December 7, 2016, 11:39pm UTC](https://forums.percona.com/t/adding-server-by-hostname-instead-of-ip-ok/5255/8 "2016-12-07T23:39:09Z")

</div>

We ended up redeploying the server as a host with a custom port and so clients can now connect.

[sysadmin@prdmesos-db03 ~]$ sudo pmm-admin list  
pmm-admin 1.0.6

PMM Server | 192.168.101.8:1007  
Client Name | prdmesos-db03  
Client Address | 192.168.101.9  
Service manager | linux-systemd

* * *

SERVICE TYPE NAME CLIENT PORT RUNNING DATA SOURCE OPTIONS

* * *

linux:metrics prdmesos-db03 42000 NO -  
mysql:queries prdmesos-db03 42001 YES root:_**@unix(/var/lib/mysql/mysql.sock) query\_source=slowlog  
mysql:metrics prdmesos-db03 42002 NO root:**_@unix(/var/lib/mysql/mysql.sock) tablestats=OFF

But none of the dashboards on the server really work, notably orchestrator doesn’t work (really wanted to monitor cluster health).

![photoid=46622](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/6/61429a58e71327b06a2a18fc8b026c55e31d6bc9.jpeg)

---

<div class="post-metadata">

**Author:** ![weber](https://avatars.discourse-cdn.com/v4/letter/w/da6949/32.png) [@weber](https://forums.percona.com/u/weber)\
**Post date:** [December 8, 2016, 2:51am UTC](https://forums.percona.com/t/adding-server-by-hostname-instead-of-ip-ok/5255/9 "2016-12-08T02:51:20Z")

</div>

For mysql:metrics to work, PMM Server should be able to connect back to the client to 192.168.101.9:42002, check out `pmm-admin check-network` output.  
Note, this is a requirement for all metric services, i.e. server \> client connection. You may need to configure firewall settings or port forwarding.

For mysql:queries the connection is done from client \> server.

For Orchestrator to work, check out [URL=“[Percona Monitoring and Management](https://www.percona.com/doc/percona-monitoring-and-management/using.html#orchestrator)”][https://www.percona.com/doc/percona-...l#orchestrator[/URL]](https://www.percona.com/doc/percona-...l#orchestrator%5B/URL%5D)
