# PMM2 mysql exporter change port after each delete/add

**URL:** <https://forums.percona.com/t/pmm2-mysql-exporter-change-port-after-each-delete-add/8205>\
**Category:** PMM 2.x\
**Tags:** pmm, mysql\
**Created:** [October 28, 2020, 5:35am UTC](https://forums.percona.com/t/pmm2-mysql-exporter-change-port-after-each-delete-add/8205 "2020-10-28T05:35:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mlaurent](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mlaurent](https://forums.percona.com/u/mlaurent)\
**Post date:** [October 28, 2020, 5:35am UTC](https://forums.percona.com/t/pmm2-mysql-exporter-change-port-after-each-delete-add/8205/1 "2020-10-28T05:35:30Z")

</div>

Hello,

When I add the mysql export on my client, the port changes each time : 42001 then 42002 then 42003 …

Prometheus manages to make the connection to get the metrics, only with port 42002, on the other ports I get the error “context deadline expected”.

On my firewall, ports 42000 to 50000 are open.

Example of command :

pmm-admin add mysql [--server-url=\_COPY15@myhttpsserver.com](mailto:--server-url=_COPY15@myhttpsserver.com) --query-source=slowlog --username=example --password=example

==\> if I run a ps aux | grep pmm, the service runs on port 42001

pmm-admin remove mysql serverName-mysql

pmm-admin add mysql [--server-url=\_COPY15@myhttpsserver.com](mailto:--server-url=_COPY15@myhttpsserver.com) --query-source=slowlog --username=example --password=example

==\> if I run a ps aux | grep pmm, the service runs on port 42002

Someone manages to reproduce it? I don’t know if it’s a bug, or a configuration problem on my side.

Have a nice day

---

<div class="post-metadata">

**Author:** ![Vadim\_Yalovets](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vadim_yalovets/32/43_2.png) [@Vadim\_Yalovets](https://forums.percona.com/u/Vadim_Yalovets)\
**Post date:** [October 29, 2020, 5:29am UTC](https://forums.percona.com/t/pmm2-mysql-exporter-change-port-after-each-delete-add/8205/2 "2020-10-29T05:29:01Z")

</div>

Hi Laurent,

It’s possible to monitor few services by the same pmm-agent. Each new exporter will be start on an available 420xx port.

Could you check if any errors are shown in pmm agent log?

/var/log/pmm-agent.log

 ![Screenshot_20201029_125153.png](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/1X/139edd4a03a347b49b82b6e5dc099b9998725019.png)

---

<div class="post-metadata">

**Author:** ![mlaurent](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mlaurent](https://forums.percona.com/u/mlaurent)\
**Post date:** [November 3, 2020, 9:56am UTC](https://forums.percona.com/t/pmm2-mysql-exporter-change-port-after-each-delete-add/8205/3 "2020-11-03T09:56:31Z")

</div>

Hi,

I have this error in the logs for November 2nd :

```auto
Nov 2 18:00:17 dba pmm-agent[2922]: #033[36mINFO#033[0m[2020-11-02T18:00:17.051+01:00] time="2020-11-02T18:00:17+01:00" level=info msg="Successfully scraped status with query: SHOW ALL SLAVES STATUS" source="slave_status.go:113" #033[36magentID#033[0m=/agent_id/be83475c-e4b3-4e80-8396-cdc77ecc224c #033[36mcomponent#033[0m=agent-process #033[36mtype#033[0m=mysqld_exporter
Nov 2 18:00:17 dba pmm-agent[2922]: #033[36mINFO#033[0m[2020-11-02T18:00:17.051+01:00] time="2020-11-02T18:00:17+01:00" level=error msg="Error scraping for collect.custom_query.hr: mysql_perf_schema_replication_group_worker_5:error running query on database: mysql_perf_schema_replication_group_worker_5, Error 1146: Table 'performance_schema.replication_connection_status' doesn't exist:mysql_perf_schema_replication_group:error running query on database: mysql_perf_schema_replication_group, Error 1193: Unknown system variable 'server_uuid':mysql_perf_schema_replication_group_5:error running query on database: mysql_perf_schema_replication_group_5, Error 1193: Unknown system variable 'server_uuid':mysql_perf_schema:error running query on database: mysql_perf_schema, Error 1193: Unknown system variable 'server_uuid':mysql_perf_schema_5:error running query on database: mysql_perf_schema_5, Error 1193: Unknown system variable 'server_uuid':mysql_perf_schema_replication_group_worker:error running query on database: mysql_perf_schema_replication_group_worker, Error 1305: FUNCTION GTID_SUBTRACT does not exist" source="exporter.go:116" #033[36magentID#033[0m=/agent_id/be83475c-e4b3-4e80-8396-cdc77ecc224c #033[36mcomponent#033[0m=agent-process #033[36mtype#033[0m=mysqld_exporter
The agent rebooted, it was running on port 42002 and I was receiving logs. It rebooted at 6pm last night on port 42001, and I'm not receiving anything anymore.
Here are the current logs, no apparent error:
Nov 3 16:19:00 dba pmm-agent[2922]: #033[36mINFO#033[0m[2020-11-03T16:19:00.001+01:00] Sending 66 buckets. #033[36magentID#033[0m=/agent_id/58660e56-3e9a-4522-92e6-b07b2395b828 #033[36mcomponent#033[0m=agent-builtin #033[36mtype#033[0m=qan_mysql_slowlog_agent
Nov 3 16:20:00 dba pmm-agent[2922]: #033[36mINFO#033[0m[2020-11-03T16:20:00.001+01:00] Sending 92 buckets. #033[36magentID#033[0m=/agent_id/58660e56-3e9a-4522-92e6-b07b2395b828 #033[36mcomponent#033[0m=agent-builtin #033[36mtype#033[0m=qan_mysql_slowlog_agent
Nov 3 16:21:00 dba pmm-agent[2922]: #033[36mINFO#033[0m[2020-11-03T16:21:00.000+01:00] Sending 30 buckets. #033[36magentID#033[0m=/agent_id/58660e56-3e9a-4522-92e6-b07b2395b828 #033[36mcomponent#033[0m=agent-builtin #033[36mtype#033[0m=qan_mysql_slowlog_agent

```

I have my firewall open on the following ports : 42000:42020/tcp ALLOW Anywhere

Thanks

---

<div class="post-metadata">

**Author:** ![Vadim\_Yalovets](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vadim_yalovets/32/43_2.png) [@Vadim\_Yalovets](https://forums.percona.com/u/Vadim_Yalovets)\
**Post date:** [November 3, 2020, 11:37am UTC](https://forums.percona.com/t/pmm2-mysql-exporter-change-port-after-each-delete-add/8205/4 "2020-11-03T11:37:44Z")

</div>

Hi Laurent,

Error for November 2nd has fixed in the next release

[https://jira.percona.com/browse/PMM-6650](https://jira.percona.com/browse/PMM-6650)

And it has no relation to the issue.

Could you check if PMM server is still scraping the old port (42002) ?

It’s expected that server is notified by pmm-agent refer port changes.

e.g.

 ![Screenshot_20201103_190250.png](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/1X/343b36edcca6c305a00bdb816e9611f118ae6964.png)

 ![Screenshot_20201103_190529.png](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/1X/a02dfdd037a10215b09a5d018a2e1180728c4dfa.png)

 ![Screenshot_20201103_190357.png](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/1X/0167b4d5cb931d2c722c3abc2c3514862121c8ef.png)
