Zabbix monitoring docker application configuration

Zabbix monitoring docker application configuration

The application of containers is becoming more and more common, but how do we manage a large number of containers? Of course it is monitored!

Today's article is about using zabbix to monitor docker containers!

About the principle of docker monitored by zabbix:

  • Agent2 monitors Docker by calling the Docker API to obtain data
  • The plugin directory is stored in zabbix-agent2/src/go/plugins/docker
  • The client.go file defines the use of Unix socket addresses for communication between the docker client and the server.
  • The default socket location is /var/run/docker.sock

The deployment of docekr monitored by zabbix is ​​roughly divided into five parts:

1. Download zabbix-agent2

  • Install zabbix-agent2 on the monitored host. Note: it is agent2, not agent.
  • The zabbix-agent2 version must be consistent with the server version
wget https://repo.zabbix.com/zabbix/5.2/rhel/7/x86_64/zabbix-agent2-5.2.7-1.el7.x86_64.rpm
rpm -ivh zabbix-agent2-5.2.7-1.el7.x86_64.rpm

2. Modify the configuration file and set the basic configuration.

vim /etc/zabbix/zabbix_agent2.conf
Server=192.168.1.4
ServerActive=192.168.1.4 #Start active data push mode Hostname=192.168.1.5

3. Add the zabbix user to the docker group. This is very important and must not be ignored.

Because after installing zabbix-agent2, a user zabbix will be created by default

id zabbix
uid=997(zabbix) gid=995(zabbix) group=995(zabbix)

To get the docker data, we need to have access to the /var/run/docker.sock socket.

ll /var/run/docker.sock 
srw-rw---- 1 root docker 0 Jul 7 09:09 /var/run/docker.sock

We can see that in addition to the root user, the docker group also has read and write permissions, so we add the zabbix user to the docker group.

usermod -aG docker zabbix
id zabbix
uid=997(zabbix) gid=995(zabbix) group=995(zabbix),994(docker)

4. Run the zabbix-agent2 service

systemctl start zabbix-agent2
systemctl enable zabbix-agent2

5. Configure on the web page

  • In this experiment, our client still uses the host 192.168.1.5
  • Steps: Click Configuration - Host - Click 192.168.1.5 host - Template - Select Link New Template - Host Group - Template - Select Docker - Click Update

insert image description here
insert image description here
insert image description here
insert image description here

After the update, we can see that there is docker in the monitoring item in配置——主機

insert image description here

After a while, we can view the monitored docker information in監測——最新數據

insert image description here

At this point we run a docker container of web01

docker run -d -p 80:80 --name web01 nginx:1.16.1
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
17095d63ed44 nginx:1.16.1 "nginx -g 'daemon of..." 20 minutes ago Up 20 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp web01

After a while, we can see that zabbix detects the content of the docker container about the web01 container

insert image description here

The template used in this article is the built-in template. So far, our content about zabbix monitoring docker is complete!

This is the end of this article about zabbix monitoring docker application configuration. For more relevant zabbix monitoring docker content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to deploy zabbix_agent in docker
  • Create a code example of zabbix monitoring system based on Dockerfile
  • Detailed explanation of the process of installing Zabbix using Docker and configuring custom monitoring items

<<:  MySQL sorting using index scan

>>:  4 ways to achieve a two-column layout with fixed left column and adaptive right column using CSS

Recommend

Solution to overflow:hidden failure in CSS

Cause of failure Today, when I was writing a caro...

Analysis and summary of the impact of MySQL transactions on efficiency

1. Database transactions will reduce database per...

HTML tag full name and function introduction

Alphabetical DTD: Indicates in which XHTML 1.0 DT...

Search optimization knowledge to pay attention to in web design

1. Link layout of the new site homepage 1. The loc...

Vue implements the drag and drop sorting function of the page div box

vue implements the drag and drop sorting function...

How to use Vue to develop public account web pages

Table of contents Project Background start Create...

Complete steps to build a Laravel development environment using Docker

Preface In this article, we will use Docker to bu...

Code analysis of user variables in mysql query statements

In the previous article, we introduced the MySQL ...

How to use DQL commands to query data in MySQL

In this article, the blogger will take you to lea...

How to deploy springcloud project with Docker

Table of contents Docker image download Start mys...

An example of implementing a simple infinite loop scrolling animation in Vue

This article mainly introduces an example of Vue ...

Summary of MySQL development standards and usage skills

1. Naming conventions 1. Database names, table na...

How to update, package, and upload Docker containers to Alibaba Cloud

This time, we will try to package the running con...