# How to set static port for mysql\_exporter

**URL:** <https://forums.percona.com/t/how-to-set-static-port-for-mysql-exporter/39241>\
**Category:** PMM 3.x\
**Created:** [September 1, 2025, 12:45pm UTC](https://forums.percona.com/t/how-to-set-static-port-for-mysql-exporter/39241 "2025-09-01T12:45:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hung\_le](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/hung_le/32/12170_2.png) [@hung\_le](https://forums.percona.com/u/hung_le)\
**Post date:** [September 1, 2025, 12:45pm UTC](https://forums.percona.com/t/how-to-set-static-port-for-mysql-exporter/39241/1 "2025-09-01T12:45:28Z")

</div>

Hi all,

Im having 3 nodes using:

> pmm-admin version: 3.3.1  
> pmm-agent version: 3.3.1

These agents running in Pull method. I set up mysql\_exporter using:

> pmm-admin add mysql  
> –username=pmm  
> –password=pmmpassword  
> –host=localhost  
> –port=3306  
> –metrics-mode=pull  
> –query-source=perfschema  
> –agent-password=pmmpassword

This allows me to use my own prometheus, and alertmanager can scrape and monitor pmm agent metrics ( I can use my ansible, template files to setup prometheus and alertmanager).

The problem is the mysql\_exporter port is not the same in between nodes. Node 1 has mysql\_exporter running with port 42002, but others running with 42001.

I want to use same port because Im setting up my prometheus and alertmanager using ansible, which requires a template for pmm’ metrics endpoints.

How can I set static port for mysql\_exporter ?

Thanks.
