Monitoring Docker containers using zabbix

This will be a short tutorial on how to monitor Docker containers using the Zabbix agent. First, you need to set-up the Zabbix agent on your Linux host:
Install Zabbix-agent 3.4 on Linux

When you have installed the agent and configured it within the Zabbix server we can continue.

  1. We are going to start by downloading the necessary files that we need to configure our Zabbix agent so that it can monitor the Docker containers.
    git clone https://github.com/dimuskin/ax-zabbix-docker.git
  2. Copy the following files into the Zabbix folder and set the correct permission on the Python file.
    cp ax-zabbix-docker/zabbix-agent/linux_zabbix_agent.conf /etc/zabbix/zabbix_agentd.d/
    cp ax-zabbix-docker/scripts/docker.py /etc/zabbix/
    chmod 755 /etc/zabbix/docker.py
  3. Add the zabbix user to the docker group so it has permission to read the container data.
    sudo usermod -a -G docker zabbix
  4. Restart the Zabbix agent and verify that it is running.



With the agent done we continue by importing the template into Zabbix. The git folder contains 2 templates, 1 for passive and 1 for active clients, which we will both import into Zabbix. After this is done we will only assign one of the two to our docker host.

  1. Import the XML file by going to the Templates page on Zabbix, you can find it under Configuration. At the top-right corner, you have the button Import, from there you can specify the XML file and let it import.
  2. Now you can assign the template to the docker host in the Hosts page. In my case, I am using an Active agent which is why I will assign the Active template.

  1. That's it! It will now run a discovery rule every 30 seconds that will find every container en create the appropriate items for it.


    source: https://github.com/dimuskin/ax-zabbix-docker