Monitoring MySQL from docker on host

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

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 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!

2 Likes

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!

1 Like

I’m so sorry! I misread where you were in the process. We have this guide 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!

1 Like