Piggyback translation with Dynamic host management and Docker not working properly

CMK version: Checkmk Enterprise Edition 2.1.0p20
OS version: Debian GNU/Linux 10 (buster)

Situation: We are running docker on some hosts and we want to monitor them. These containers have sometimes exactly the same name on different hosts. Lets name them Host-A and Host-B To work around this problem I wanted to use the Hostname translation for piggybacked hosts rule to add the hostnames in front of the container name.

I also added the source host (where the containers are running) under Conditions → Explicit hosts
I also configured dynamic host management do automatically add containers as hosts:

My rules look like this (I changed the hostname for security reasons):

I already have monitored container as hosts for Host-A, because the creation process itself is working. BUT: The prefix is not added, and the containers just got named as they are on the system. Host-B´s container are not created, because there would be a pair of hosts with the same name, which is not possible.
The container creation in checkmk itself is configred with Host name used for containers.

Host name used for containers: Name - Use the name of the container

Host-A:
Check_MK Agent: Version: 1.6.0p27, OS: linux

Host-B:
Check_MK Agent: Version: 1.6.0p27, OS: linux

The agents are still on the old version, because these hosts are in an DMZ environment, and there has to be some firewall configurations so the new communication method of the 2.1 agent is working.

Question: What am I doing wrong and how is it possible to get it to function properly?

If there are is more information needed, i will provide is asap! Thanks in advance!

Hi @phahn
have you managed to find a solution?
We’ve just upgraded to Checkmk Enterprise Edition 2.1.0p32 and we’ve just run into this.

Peter

I’m on 2.2.0p14.cre on Debian 11.
I tested the creationof a container with its short ID f9b8cb804f1b as hostname in CheckMK.
=> it is working fine : all container services are properly discovered from piggyback data of hosting docker node hb-dev3.

But I’m looking for a way to have Docker containers with following name :
<docker_hostname>_<short_container_id>.
I created a rule " Hostname translation for piggybacked hosts" with following configuration :

  • Multiple regular expression :
    (.+) : hb-dev3_\1
  • Explicit hosts : hb-dev3 node
    Of course I created a host hb-dev3_f9b8cb804f1b
    But it’s not working : no service discovered for hb-dev3_f9b8cb804f1b
    ON CheckMK server, the folder is still /opt/omd/sites//tmp/check_mk/piggyback/f9b8cb804f1b/

It seems that the rule is not taken in account.
I have another rule to translate Nutanix vms name, which is working fine.

What am I doing wrong ?
THx

Hi fledorze,

you are just rewriting the piggyback data for that container, but there is no host in checkmk that matches that rewritten name.
You can take a look in /omd/sites//tmp/check_mk/piggyback.
The piggyback files there are only being “picked up” when a host in checkmk has the exact name (case sensitive), otherwise these files are just lying around there but have no effect at all.

You can choose between three different container names in the “docker node and containers” rule, but your piggyback data has to match the names that are being created there.

OK. This working fine now.
Do you think It would be possible to replace the explicit prefix above (hb-dev3) by a variable (host alias for example) to avoid to create a rule for each Docker node ?
Thx a lot for your help.