# Monitoring MySQL from docker on host

**URL:** <https://forums.percona.com/t/monitoring-mysql-from-docker-on-host/9328>\
**Category:** PMM 2.x\
**Created:** [February 18, 2021, 11:24pm UTC](https://forums.percona.com/t/monitoring-mysql-from-docker-on-host/9328 "2021-02-18T23:24:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![T\_C](https://avatars.discourse-cdn.com/v4/letter/t/8e8cbc/32.png) [@T\_C](https://forums.percona.com/u/T_C)\
**Post date:** [February 18, 2021, 11:24pm UTC](https://forums.percona.com/t/monitoring-mysql-from-docker-on-host/9328/1 "2021-02-18T23:24:14Z")

</div>

Hi there,

first of all i would like to thank you for offering this amazing piece of software for the community!

Now to my question:

I am running a debian server with mysql directly as an installed service (listening only on 127.0.0.1).  
Furthermore i am running PMM 2 inside a docker container, since i wanted to evaluate it. This docker container and PMM 2 is running perfectly and i am able to connect to it via reverse proxy over apache.  
On the host itself i have the pmm-client installed that is sending information to the docker pmm server.

After checking the normal usage i wanted to set up the pmm inside docker to monitor the mysql instance inside the host, but i didn’t find any information on how to do so.  
I don’t i.e. know what address to use on the grafana gui to allow to connect to the mysql server as well as what to configure/setup inside MySQL to allow PMM to fetch information.

So i would really appreciate if you could point me to the right direction (in form of links to blogs/man pages to read) or any other help on how to set it up that this monitoring works.

Thank you very much in advance,  
Oliver

---

<div class="post-metadata">

**Author:** ![steve.hoffman](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/steve.hoffman/32/66_2.png) [@steve.hoffman](https://forums.percona.com/u/steve.hoffman)\
**Post date:** [February 19, 2021, 12:48am UTC](https://forums.percona.com/t/monitoring-mysql-from-docker-on-host/9328/2 "2021-02-19T00:48:19Z")

</div>

Ok, so sounds like you have a host…that host has mysql installed directly on the OS, then you’re running PMM Server on that same host in a docker container. If I’m understanding correctly, your PMM instance is currently only monitoring the host (meaning you ran `pmm-admin config <params>`) but you now want to monitor the mysql instance?

if so you only need run `pmm-admin add mysql <params>` directly on the host which will use the configuration information stored from the `pmm-admin config` command and use the same IP/port combination you registered the host to (you can get more details from `pmm-admin add mysql --help` to see all the options)

I’m thrown off a little by the reverse proxy and apache but I’m taking that to mean that when you setup your docker container you did not do any kind of port forwarding? PMM server ships with nginx as a its proxy layer which handles web requests for http(s):/// as well as the gRPC communication that the pmm client and server communicate with. If that’s the case you can simplify a bit by adding `-p 8443:443` to your docker run command that created the pmm server from the image and you won’t need the reverse proxy/apache.

As an aside, we don’t generally recommend you run both pmm server and production workloads on the same system because you can end up fighting for IO and CPU between mysql and pmm’s inner components if you have several users looking at various graphs.

Anyway here’s the best [documentation](https://www.percona.com/doc/percona-monitoring-and-management/2.x/setting-up/client/mysql.html) for getting your mysql instance monitored so let us know if you need any additional pointers!

Glad you’re enjoying PMM so far…always nice to hear and feedback is always welcome on how we can make it even easier to get it up and running!

---

<div class="post-metadata">

**Author:** ![T\_C](https://avatars.discourse-cdn.com/v4/letter/t/8e8cbc/32.png) [@T\_C](https://forums.percona.com/u/T_C)\
**Post date:** [February 20, 2021, 12:04am UTC](https://forums.percona.com/t/monitoring-mysql-from-docker-on-host/9328/3 "2021-02-20T00:04:14Z")

</div>

Hi Steve,

thank you very much for your fast and detailed answer. I really appreciate it!  
You were absolutely right with all the assumptions on my setup. The reason for the apache reverse proxy was simply to hide the pmm server inside docker from the outside world and be able to add more restrictions and use some subdomains for it to connect.  
The reason for using both on the same machine is simply for evaluation purposes, so its no heavy load machine where its running on.

Back to my problem with setting up mysql monitoring: I ended up finding out that there were a few things missing: i didn’t have the pmm-agent running and didnt use the pmm-admin tool before, so without these two there was no chance of getting the monitoring work… but with the help of your doc link and some further reading i was able to find out how to do all that… was a bit too scattered along several doc pages… at least i couldn’t find that “one pager”.

So once again thanks for pushing me in the right direction, i reallly appreciate it and it makes evaluating and playing with pmm so much more interesting!

---

<div class="post-metadata">

**Author:** ![steve.hoffman](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/steve.hoffman/32/66_2.png) [@steve.hoffman](https://forums.percona.com/u/steve.hoffman)\
**Post date:** [February 20, 2021, 12:47am UTC](https://forums.percona.com/t/monitoring-mysql-from-docker-on-host/9328/4 "2021-02-20T00:47:55Z")

</div>

I’m so sorry! I misread where you were in the process. We have [this guide](https://www.percona.com/software/pmm/quickstart) to get off the ground a bit easier which will give you the basics for both client and server install!

Either way glad you are liking it and keep on the lookout for more features to come. Integrated alerting is in tech preview and the team is hard at work building backup management into the product too not to mention Database as a Service!
