I can't monitor docker with checkmk-raw

CMK version:
Version 2.1.0p24

OS version:
Debian 10

Hello, I’m trying to monitor the containers but I can’t.

I have added the host (Debian).

I have installed using:

pip3 install docker

Name: docker
Version: 6.0.1
Summary: A Python library for the Docker Engine API.
Home-page: GitHub - docker/docker-py: A Python library for the Docker Engine API
Author: None
Author-email: None
License: Apache License 2.0
Location: /usr/local/lib/python3.7/dist-packages
Requires: requests, urllib3, packaging, websocket-client
Required-by:

Then I have downloaded the mk_docker.py agent in Debian and I have executed it with:

python3 mk_docker.py

Information about the dockers appears but when I rescan the host again, the dockers do not appear.

What am I doing wrong?

Thank you so much!

Hello ttmader,

Have you placed the docker.py script into the Checkmk agent plugin directory? You need to do that so that the agent will run the script and capture the output.

Hope this helps,
Jason

Hello jsmyth!

I think I have copied it. I have done it with the following statement:

docker container cp /tmp/mk_docker.py checkmk:/opt/omd/versions/2.1.0p24.cre/share/check_mk/agents/plugins

Is there another way to do it?

Once copied, what do I have to do? Do I have to restart? I’ve rescanned without rebooting and it still doesn’t show up.

Thank you so much!

Hello ttmader,

Judging from the command you showed, it looks like that copied the plugin into a Docker container that is running the Checkmk server. What you need to do is copy the script to the agent directory on the host being monitored.

Assuming the host being monitored can access port 443 on the Checkmk server, you should be able to install the plugin with the following script:

# Define variables
# Make sure there is no trailing slash on $cmkPluginDir
cmkDns=checkmk.example.com
cmkSite=omd
cmkPluginDir=/usr/lib/check_mk_agent/plugins
cmkPluginName=mk_docker.py
 
# Download the file
downloadUrl="https://${cmkDns}/${cmkSite}/check_mk/agents/plugins/${cmkPluginName}"
sudo wget -P "${cmkPluginDir}" "${downloadUrl}"
 
# Ensure correct ownership and permissions
sudo chown root: "${cmkPluginDir}/${cmkPluginName}"
sudo chmod 755 "${cmkPluginDir}/${cmkPluginName}"

Hope this helps,
Jason

1 Like

I have been silly. She was making it very complicated and it was simple. Thank you so much!

On the other hand, can you monitor the RAM consumption of each of the dockers?

Greetings.

The following is a example from one of my containers and you see the memory & CPU consumption.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.