ThisCalculator

Everyday

Monitor Docker Containers with Zabbix: A Practical Guide

Updated · Standard formula, shown below

Yes, you can monitor Docker containers with Zabbix, and it is one of the most common ways to keep an eye on containerized infrastructure. You set up the Zabbix agent on the Docker host, enable the built-in Docker template, and Zabbix will automatically discover and track containers, their CPU, memory, network I/O, and status. This article explains how the integration works, what you need to configure, and how to troubleshoot common issues.

Why Monitor Docker with Zabbix?

Docker containers are ephemeral by design—they start, stop, scale, and get replaced frequently. Traditional host-level monitoring (CPU, memory, disk) misses what happens inside each container. Zabbix fills that gap by collecting metrics directly from the Docker daemon via its API, so you see per-container resource usage, health status, and network activity in the same dashboard you already use for your servers.

Zabbix’s Docker integration is built around two official templates: Docker by Zabbix agent 2 and Docker by Zabbix agent. The agent 2 version is recommended for new deployments because it natively supports the Docker API and requires less custom scripting. Both templates perform auto-discovery of containers, so you don’t need to manually add each one.

How the Zabbix Docker Integration Works

Zabbix does not monitor Docker containers directly from the Zabbix server. Instead, it relies on a Zabbix agent running on the Docker host. The agent communicates with the Docker daemon (usually via the Unix socket /var/run/docker.sock) and retrieves metrics using the Docker Engine API. The agent then sends those metrics to the Zabbix server or proxy, which stores them and triggers alerts based on thresholds you define.

For agent 2, the Docker plugin is built-in. You only need to ensure the agent has permission to access the Docker socket. On most Linux distributions, this means adding the zabbix user to the docker group. On some systems, you may need to adjust the socket permissions or use a proxy like socat if the socket is not accessible.

Step-by-Step Setup (Agent 2)

  1. Install Zabbix agent 2 on the Docker host. Use your distribution’s package manager (e.g., apt install zabbix-agent2 on Debian/Ubuntu, yum install zabbix-agent2 on RHEL/CentOS).
  2. Add the zabbix user to the docker group so the agent can read the Docker socket: sudo usermod -aG docker zabbix. Then restart the agent service.
  3. Configure the agent to point to your Zabbix server or proxy. Edit /etc/zabbix/zabbix_agent2.conf and set Server and ServerActive to your Zabbix server’s IP or hostname.
  4. On the Zabbix frontend, go to Data collection → Hosts, create a new host (or edit an existing one) and link the template “Docker by Zabbix agent 2”.
  5. Set the host’s interface to the agent’s IP and port (default 10050).
  6. Wait for discovery—Zabbix will automatically find running containers and start collecting metrics. You can check Monitoring → Hosts → Latest data to verify.

If you are using the classic agent (not agent 2), you need to install and configure the zabbix-agent plus a separate Docker monitoring script. However, agent 2 is simpler and is the default in Zabbix 6.0 and later.

What Metrics Can You Monitor?

Once the template is linked, you get a rich set of metrics for each container:

  • Status – running, exited, paused, dead, created.
  • CPU usage – percentage of total host CPU, and per-container CPU time.
  • Memory usage – current usage, limit, and percentage.
  • Network I/O – bytes received/transmitted per interface.
  • Block I/O – bytes read/written from storage.
  • Number of running processes inside the container (if available).
  • Container health – if a health check is defined in the image.

You can also create custom items using the docker.info key to get raw JSON data from the Docker API, but the template covers most needs out of the box.

Common Problems and How to Fix Them

The most frequent issue is “No data received” or “Unreachable” for the Docker host. Here are the usual causes:

  • Agent cannot access the Docker socket. Check that the zabbix user is in the docker group and that the socket permissions allow read/write. Test with sudo -u zabbix docker ps.
  • Firewall blocking port 10050. Ensure the Zabbix server can reach the agent on TCP port 10050.
  • Agent configuration mismatch. Verify that Server in the agent config matches the Zabbix server’s IP, and that the host in Zabbix has the correct interface IP.
  • Docker API version mismatch. Very old Docker versions may not be supported by the agent 2 plugin. Zabbix 6.0 requires Docker API 1.24 or higher (Docker 1.12+).
  • Container discovery not working. If you see the host but no containers, check that the template’s discovery rules are enabled and that the agent has permission to list containers.

If you are using SELinux (e.g., on RHEL), you may need to set the boolean container_connect_any to true: setsebool -P container_connect_any 1.

Zabbix vs. Other Docker Monitoring Tools

Zabbix is not the only tool for Docker monitoring, but it has strengths that make it a good fit for many teams. Compared to Prometheus, Zabbix offers a more traditional agent-based model with built-in alerting, notifications, and a web UI—no need to assemble Grafana, Alertmanager, and exporters. Compared to commercial tools like Datadog or New Relic, Zabbix is open-source and free, though it requires more effort to set up and tune.

For large dynamic environments with hundreds of containers, Zabbix can handle it, but you need to plan your proxy architecture and reduce the polling frequency to avoid overwhelming the server. Prometheus is often preferred in Kubernetes-native environments because of its pull model and service discovery, but Zabbix works well for hybrid environments with both VMs and containers.

Cost and Licensing Considerations

Zabbix is open-source under the GNU General Public License (GPL) version 2, so there is no license fee for the core product. You can monitor an unlimited number of hosts and containers. However, you should consider the infrastructure cost: running a Zabbix server, database (PostgreSQL or MySQL), and possibly proxies requires hardware and maintenance. For small setups, a single server with 4 GB RAM is enough; for large fleets, you may need a dedicated database server and multiple proxies.

There are no official paid tiers—Zabbix offers commercial support and training, but the software itself is free. This makes it an attractive option for organizations that want to avoid per-container or per-host fees.

Frequently Asked Questions

Can Zabbix monitor Docker containers without installing an agent on the host?

No, Zabbix requires an agent on the Docker host. The agent can be the classic Zabbix agent or agent 2. Without an agent, Zabbix cannot access the Docker daemon’s API. You could use SSH-based monitoring, but that is less efficient and not recommended.

Does Zabbix monitor containers that are not running?

Yes, the discovery rule will find containers in any state (running, exited, paused, etc.). However, metrics like CPU and memory are only available for running containers. Exited containers will show a status but no resource usage.

How do I get alerts when a container goes down?

You can create a trigger on the item docker.container.status with a condition like last()<>1 (where 1 means “running”). The template already includes some triggers, but you can customize them based on your needs.

Is it possible to monitor Docker containers on Windows hosts?

Yes, Zabbix agent 2 supports Windows, and the Docker plugin works with Docker Desktop or Windows containers. However, the setup is slightly different because the Docker socket is a named pipe, and you need to configure the agent accordingly. The official documentation covers Windows specifics.

Can I monitor Kubernetes pods with Zabbix?

Zabbix has a separate Kubernetes template that monitors cluster-level metrics (nodes, pods, services) via the Kubernetes API. For container-level metrics inside pods, you would still need agents on the nodes or use the Docker template if you have access to the Docker socket. Zabbix 6.0 has improved Kubernetes integration, but it is not a full replacement for tools like Prometheus in complex Kubernetes environments.

What is the difference between “Docker by Zabbix agent 2” and “Docker by Zabbix agent” templates?

The agent 2 template uses the built-in Docker plugin of Zabbix agent 2, which communicates directly with the Docker API. The classic agent template uses an external script that must be installed separately. Agent 2 is easier to set up, more reliable, and recommended for new installations.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.