Select Page

How to setup Docker container monitoring with Zabbix

How to setup Docker container monitoring with Zabbix

In a Docker infrastructure, monitoring the containers is vital to ensure that a single container do not end up abusing the host machine and crash other containers.

Docker container monitoring involves keeping an eye on the metrics such as available CPU, mem, blkio, etc. These metrics for a container can be seen with the command ‘docker stats‘.

Docker container metrics

Docker container metrics

But monitoring containers from the backend manually is a time-consuming process and not feasible for pro-active management of machines.

Save your Docker containers from crash

GET IN TOUCH WITH THE DOCKER EXPERTS NOW!

This makes it important to have a monitoring system setup for the Docker containers.

Docker container monitoring with Zabbix

We setup a custom Zabbix server for our internal system monitoring purposes. Zabbix is an open source monitoring software for network and applications.

Zabbix consists of a server running in a container and agents running on the machines that need to be monitored. The machine data are stored in a database.

To install Zabbix server in a Docker container, create a container using the ‘docker-zabbix’ image:

docker run -d -P --name zabbix  berngp/docker-zabbix 

To monitor Docker containers using Zabbix, a Zabbix agent has to be installed in the Docker machine. Zabbix agent is an application that tracks the metrics of systems being monitored.

We added our Docker infrastructure to that monitoring system with these steps:

1. Create Zabbix Agent container

The first step is to create a container with Zabbix agent image, specifying the Zabbix server IP, with this command:

docker run \
 --name=zabbix-agent-xxl \
 -h $(hostname) \
 -p 10050:10050 \
 -v /:/rootfs \
 -v /var/run:/var/run \
 -e "ZA_Server=<ZABBIX SERVER IP/DNS NAME>" \
 -d monitoringartist/zabbix-agent-xxl-limited:latest

 

You can see the newly created Zabbix Agent container running in the Docker machine, with the ‘docker ps’ command:

 

Create Zabbix Docker container

Create Zabbix Docker container

 

2. Configure the Zabbix Agent

The configuration file for the Zabbix Agent is available at ‘/etc/zabbix/zabbix_agentd.conf’. This file contains details such as Zabbix server and other parameters.

In the Zabbix server, add the hosts (containers to be monitored) and the triggers for them. This can be done easily with the help of Zabbix templates.

The container metrics for CPU, I/O, memory, disk usage, etc. can be retrieved from their containers’ cgroup stats folders and monitored using Zabbix.

To test the Zabbix agent, the utility ‘zabbix_agent_bench’, the bench-marking tool, can be used.

 

Benchmarking the Zabbix agent

Benchmarking the Zabbix agent

[ Running a Docker infrastructure doesn’t have to be hard, or costly. Get world class Docker management services at affordable pricing. ]


Secure your Docker images!

Wish you had more time to focus on your business? Let us help you.

Our engineers will assist you to setup, monitor and manage your Docker infrastructure 24/7.

GET IN TOUCH WITH THE EXPERTS NOW!




Bobcares provides Outsourced Hosting Support and Outsourced Server Management for online businesses. Our services include Hosting Support Services, server support, help desk support, live chat support and phone support.

2 Comments

  1. Thank you for your artcile.

    “Zabbix consists of a server running in a container” – is it a necessary requirement for Zabbix server to be installed inside a container?

    Actually, our Zabbix server is installed just as an ordinary VM. We would like to monitor our Docker containers without any modifications regarding to Zabbix server itself.

    Thank you!

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Bobcares
Bobcares is a server management company that helps businesses deliver uninterrupted and secure online services. Our engineers manage close to 51,500 servers that include virtualized servers, cloud infrastructure, physical server clusters, and more.
MORE ABOUT BOBCARES

Privacy Preference Center

    Necessary

    Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

    PHPSESSID - Preserves user session state across page requests.

    gdpr[consent_types] - Used to store user consents.

    gdpr[allowed_cookies] - Used to store user allowed cookies.

    PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
    PHPSESSID
    WHMCSpKDlPzh2chML

    Statistics

    Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

    _ga - Preserves user session state across page requests.

    _gat - Used by Google Analytics to throttle request rate

    _gid - Registers a unique ID that is used to generate statistical data on how you use the website.

    smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

    _ga, _gat, _gid
    _ga, _gat, _gid
    smartlookCookie

    Marketing

    Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

    IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

    test_cookie - Used to check if the user's browser supports cookies.

    1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

    NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

    DV - Google ad personalisation

    IDE, test_cookie, 1P_JAR, NID, DV, NID
    IDE, test_cookie
    1P_JAR, NID, DV
    NID