How-to: Automatically add docker containers as hosts to checkmk

Hello everyone,
I want to share my small script with all of you on how to automatically add docker containers as hosts in checkmk.

This is especially interesting for all checkmk raw users out there, because only in the commercial editions of checkmk docker containers are automataclly added as hosts:

“In the commercial editions you can have these hosts created automatically” https://docs.checkmk.com/latest/en/monitoring_docker.html#_monitoring_the_containers

Tutorial on my website:

https://hostlab.tech/blog/checkmk-docker-containers-as-hosts

4 Likes

Excellent contribution. Thank you

Thanks for this. Works great. Just one question. First time I ran the script from the command line and noticed this in the output:
./docker-container-check.sh: line 22: [: : integer expression expected

Line 22 is:
if [ "$result" -gt 350 ]; then

Like I said, in the end it works great. The conainers are nicely discovered and activated in CheckMK.