python2 is dead since January 2020 officially - but mk_docker.py is not working with Python 3.
Got it running with 2to3 utility, but now I become the following error
<<<docker_node_info:sep(0)>>> @docker_version_info{“PluginVersion”: “0.1”, “DockerPyVersion”: “4.2.0”, “ApiVersion”: “1.40”}
{“Unknown”: “Plugin exception in section_container_agent: ‘SocketIO’ object has no attribute ‘recv’”}
The other checks working fine, but for the agent status I got an unknown error
Any ideas? Downgrade to python2 is not an option.
Inside github you find already two versions of the mk_docker plugin.
That is relative - as long as you have RHEL 6 and 7 official supported out there you will also have python 2.7 out there as the default version on many enterprise systems
Ok, checked it, I guess mk_docker.py is python3. So the error is still there:
<<<docker_node_info:sep(0)>>> @docker_version_info{“PluginVersion”: “0.1”, “DockerPyVersion”: “4.2.0”, “ApiVersion”: “1.40”}
{“Unknown”: “Plugin exception in section_container_agent: ‘SocketIO’ object has no attribute ‘recv’”}
This error looks more like a problem that the plugin cannot read data from the docker.sock.
How does your config file looks like and where is your docker.sock inside the system.
def section_node_images(client):
'''in subsections list [[[images]]] and [[[containers]]]'''
section = Section('node_images')
images = client.images.list()
LOGGER.debug(images)
section.append('[[[images]]]')
for image in images:
section.append(json.dumps(image.attrs))
LOGGER.debug(client.all_containers)
section.append('[[[containers]]]')
for container in client.all_containers.itervalues():
section.append(json.dumps(container.attrs))
section.write()
Change to
def section_node_images(client):
'''in subsections list [[[images]]] and [[[containers]]]'''
section = Section('node_images')
images = client.images.list()
LOGGER.debug(images)
section.append('[[[images]]]')
for image in images:
section.append(json.dumps(image.attrs))
LOGGER.debug(client.all_containers)
section.append('[[[containers]]]')
for container in client.all_containers:
section.append(json.dumps(client.all_containers[container].attrs))
section.write()
no, just the single check node info is not
working. And I guess the configuration for
showing name, id short or long is related to this.
This is also not working, but the rest is working
fine. I habe a lot of checks, containers are created
and so on… just this single one and the naming rule.
This exception i get only if inside the container is no CMK agent installed. With this one modification before all other things are working.
The exception is correct if you have no agent inside your containers.
Ah ok! I have no agents installed. But in this case
do you think the rule for naming is also not
working? I have a static name mapping for my
container
yes, if I configure it via /etc/check_mk/docker.cfg it works
but I tried it with rules - this doesn’t work - but in the documentation
they mentioned the rule based way.
yeah, verified it again. If I follow the documentation regarding the ruleset - this does not
work; if I set it in docker.cfg, all is working fine. I guess the ruleset is valid only in combination
with agent backery…?