Monitoring some Docker-Containers

Hello icinga-community,

I just installed a icinga2 instance to monitor our internal infrastructure.
The infrastructur contains multiple VMs and also containers.

We used nagios before.

Icinga2 (Icingaweb2+director) is installed on our monitoring-server and on the dockerhost icinga2 and the monitoring-plugins are installed.

I “walked” through the icinga wizard on the client (dockerhost) :
icinga2 node wizard

Both are able to communicate with eachother and the standard-plugins are working fine.

But we need to monitor the docker-container as well.
The plugin is the following → GitHub - timdaman/check_docker: Nagios plugin to check docker containers · GitHub

What I did:

  1. I added the “check_docker” script to the dockerhost, also installed the “python docker library” on the dockerhost and I added the Command to /etc/icinga2/conf.d/commands.conf .
object CheckCommand "check_docker" {
import "plugin-check-command"
command = [ PluginDir + "/check_docker" ]

arguments = {
"--containers" = {
value = "$container_name$"
description = "Container Name"
}
"--status" = {
value = "$container_status$"
description = "Status of the container"
}
}
vars.container_name = all
vars.container_status = running
}
  1. The user nagios is allowed to use the script (check_docker) by using sudo without a password on the dockerhost.
  2. I created a command in the director and it looks like that:

  1. Next I defined some data fileds for the connection, the container and the status:

  2. The Preview looks like this:

  3. At next I created a service template for just one container (PiHole for example)

  1. I created a service next for one host - the dockerhost (example)
  2. I deployed the configuration in icinga director with no error:
  3. But the check fails with - Check command ‘check_docker’ does not exist.

I may have forgotten to configure the command for a specific location in icinga, but where?
Iam a little bit confused :grinning_face:
Does anyone have any ideas?

Best regards from near Berlin and sorry for the “german screenshots”

OliKaa

Hi and welcome to the Icinga community :slight_smile:

On your first screenshot, remove the “master” setting of “Cluster Zone” and change it to “please choose”
If this doesnt help: Could you maybe show the /etc/icinga2/zones.conf on both, master and agent?
To me it looks like the CheckCommand object gets not properly synced, as you are expecting it.

Cheers from Nuremberg :wink:

Hi and welcome

I just got some extended docker checks created by the @linuxfabrik for me, so I may not be impartial but still I can recommend the monitoring-plugins by the Linuxfabrik, for monitoring Docker.

@bberg Thanks a lot

The “Cluster Zone” did the first trick.

I got new error messages - great :slight_smile:

I also need to add the arguments to fields.
But than I got a new error message during the deployment …

I changed the “Render to string” option to NO

image

So it works now:

The result:

And everyone is happy

@rivad Thank you for the information. I’ll keep an eye on it.