Monitoring Docker containers with Zabbix Agent 2 provides a powerful way to keep track of your containerized environments. In this guide, we’ll walk you through the steps to install Zabbix Agent 2, configure it for Docker monitoring, and ensure it’s running smoothly.
Step 1: Install Zabbix Repository
To get started, add the Zabbix repository to your system. This will allow you to install the latest Zabbix Agent 2 package.
wget https://repo.zabbix.com/zabbix/7.0/debian/pool/main/z/zabbix-release/zabbix-release_7.0-2+debian12_all.deb
sudo dpkg -i zabbix-release_7.0-2+debian12_all.deb
sudo apt update
Step 2: Install Zabbix Agent 2
Next, install Zabbix Agent 2 along with the necessary plugins for extended monitoring capabilities.
sudo apt install zabbix-agent2 zabbix-agent2-plugin-*
The zabbix-agent2-plugin-*
option ensures all available plugins, including the Docker monitoring plugin, are installed.
Step 3: Start and Enable Zabbix Agent 2
Once installed, you need to start the Zabbix Agent 2 service and enable it to run at system boot.
sudo systemctl restart zabbix-agent2
sudo systemctl enable zabbix-agent2
Step 4: Configure Zabbix Agent 2
Now, configure Zabbix Agent 2 to communicate with your Zabbix server. Open the configuration file for editing:
sudo nano /etc/zabbix/zabbix_agent2.conf
In the configuration file, make the following changes:
- Server: Specify your Zabbix server’s IP address.
Server=123.123.123.179
- ServerActive: Enable active mode by adding your Zabbix server’s IP.
ServerActive=123.123.123.179
- Hostname: Ensure the hostname matches the one configured in the Zabbix web interface for this host.
Hostname=bistux
Step 5: Configure Docker Monitoring Permissions
If you want Zabbix Agent 2 to monitor Docker containers, you need to add the zabbix
user to the docker
group. This grants Zabbix Agent 2 permission to access Docker resources.
sudo usermod -aG docker zabbix
After adding the permission, restart the Zabbix Agent 2 service:
sudo systemctl restart zabbix-agent2
Step 6: Verify Installation
To ensure that everything is working correctly, check the Zabbix Agent 2 logs for any errors or warnings:
tail -f /var/log/zabbix/zabbix_agent2.log
If there are no issues, your Zabbix Agent 2 is successfully installed and configured for Docker monitoring.