Running Docker Commands with Administration Scripts
Running Docker Commands with Zabbix Administration Scripts
In this video, I demonstrate how to use administration scripts to manage docker containers.
During the setup I encounter several issues in which I solve them all.
It's important that the agent, proxy or server process that you want to use to run the script, needs
EnableRemoteCommands=1set in it's config file. Then restart the agent, proxy or server service. The specific details of enabled remote commands depend on which version of the agent you are running, and have been covered several times in the previous sections.
If the command you execute needs privileged permissions, then run it with the sudo prefix.
To allow the zabbix user to use the sudo prefix, add a new line to the sudoers file.
zabbix ALL=(ALL) NOPASSWD: /usr/bin/docker
With these 3 things, I was able to execute docker commands on my host using the administration scripts option.
Those commands were,
1 2 3 4
To install docker on Ubuntu 20.04.
To list any docker containers,
To list any docker images that were downloaded to create the containers,
The example containers I created used in the video were from https://hub.docker.com/r/nginxdemos/hello/
1 2 3
After experimenting with docker containers and images, and you no longer want them, you can clean up your system and delete them using these commands.
EnableRemoteCommands=1 is set in your agent/proxy config. And you have restarted your agent/proxy after making the change.
If you get the error,