Search code examples
dockerzabbix

Monitor Docker container with Zabbix


I've a trigger with the following expression:

{amr101:system.run["docker inspect --format='{{.State.Running}}' my-container"].last()}=0

I believe that Zabbix, be default, uses the zabbix user on the remote host to execute commands. I've added the zabbix user to the docker group such that docker commands can be executed without sudo. For example:

zabbix@amr101:~$ docker inspect --format='{{.State.Running}}' my-container
true

As you can see, I can execute the command without fail on the actual remote host.

However, when the Zabbix server tries to do it; it fails with the error

Received value [Cannot connect to the Docker daemon. Is the docker daemon running on this host?] is not suitable for value type 

I've got the Zabbix server to execute the id command on the remote host and found that it is definitely using the zabbix user to execute it's commands.

My question therefore is; why is the Zabbix server unable to execute docker commands on the remote host when the zabbix user has been added to the docker group and can clearly execute docker commands when executed directly on the remote host?


Solution

  • Restart the Zabbix agent service. Usually when you add a user to a new group, you need to re-login for it to take affect.