Monitor you're docker containers with checkmk

Now lets start monitor you're containers with checkmk.
Requirements:
checkmk
First of all you need to download the checkmk docker plugin Go to you're checkmk instance and than monitor > section agents linux and find the mk_docker.py download it and scp it to you're checkmk server.
When you're done ssh on you're server and install it:
install -m 0755 mk_docker.py /usr/lib/check_mk_agent/plugins
Great now we can move on and install pip3 On Almalinux or RedHat based systems do this with:
yum install python3-pip
For other distributions check it out here.
Now check that the right package is installed:
pip3 uninstall docker-py docker
pip3 install docker
Go to setup > hosts >you're host and click save & run service discovery. It can take a while so you maybe have to rescan an wait but it should look like this in the end:

Click "accept all" and than in the right upper corner click the exclamation mark > activate on selected sites. Now you should see you're docker nodes:monitor > docker nodes.
Perfect you can now see rudimentary data about you're docker nodes. But there is no direct container monitoring. Checkmk uses a technique called piggyback. It refers to a method where the Checkmk agent on the Docker host collects monitoring data for all running containers, enabling centralized and efficient monitoring without needing individual agents inside each container.
We need to create the docker.cfg for checkmk . In our case we use the default template. You can download it on github.
Move it in the path /etc/check_mk/docker.cfg
Now we have to add container after container to our checkmk enviroment. I just give you one example:
go to setup > hosts . I created a folder docker-container than. Move into it and click add host.

Be careful the host name have to be exactly the container name. If you not see all this options than click show more on the right sight. You should now see something like this:

Click accapt all and repeat this step for all you're containers.
When you're done click on the exclamation mark on the upper right and click accept all.
Done under monitor > docker containers you should now see all of them 😄
Happy monitoring!