Enterprise operation and maintenance practice -- Zabbix installation and server+web+agent construction

1. Introduction

zabbix is an enterprise class open source solution based on WEB interface to provide distributed system monitoring and network monitoring functions.

zabbix can monitor various network parameters to ensure the safe operation of the server system; Flexible notification mechanism is provided to enable system administrators to quickly locate / solve various problems.

zabbix consists of two parts, zabbix server and optional component zabbix agent.

Note: zabbix agent needs to be installed on the monitored target server. It mainly collects hardware information or memory, CPU and other information related to the operating system. zabbix agent can run on Linux,Solaris,HP-UX,AIX,Free BSD,Open BSD, OS X, Tru64/OSF1, Windows NT4.0, Windows (2000/2003/XP/Vista) and other systems.
Main features of zabbix:

Simple installation and configuration, low learning cost

Support multiple languages (including Chinese)

Free open source

Automatically discover servers and network devices

Distributed monitoring and WEB Centralized management function

Can not agent monitor

User security authentication and soft authorization

adopt WEB Interface setting or viewing monitoring results

email Other notification functions

Main functions of Zabbix:

CPU load, memory usage, disk usage, network status, port monitoring, log monitoring.

2. Installation configuration

. the repo package of Centos7 version is used here:

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo    

Because there are installation packages locally, the software warehouse can be configured directly. If necessary, it can be downloaded from the official website

name=Zabbix Official Repository - $basearch

name=Zabbix Official Repository non-supported - $basearch

Install mariad

yum install zabbix-server-mysql  
yum install -y mariadb-server
systemctl enable --now mariadb.service

Create database

The database needs to be safely initialized

mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user 'zabbix'@'localhost' identified by 'westos';
mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost';

Import data:

Use MySQL to import the initial database schema and data of Zabbix server,

zcat /usr/share/doc/zabbix-server-mysql-4.0.27/create.sql.gz | mysql -uzabbix -pwestos zabbix

Edit ZABBIX_ The server.conf file to use the created database.
Enter the Zabbix database password created by MySQL in the DBPassword parameter.

vim /etc/zabbix/zabbix_server.conf edit the following


Run the following command to start the Zabbix server process:

systemctl enable --now zabbix-server
netstat -antlp

Query whether port 10051 is enabled

Install Agent

Run the following command to install the Zabbix agent

yum install zabbix-agent -y
systemctl enable --now zabbix-agent

Configuring the ZABBIX front end

yum install php-bcmath -y
yum install php-mbstring -y
yum install zabbix-web-mysql -y

After downloading, the configuration file:
The Apache configuration file for the Zabbix front end is located in / etc/httpd/conf.d/zabbix.conf.

vim /etc/httpd/conf.d/zabbix.conf
        php_value date.timezone Asia/Shanghai

systemctl enable --now httpd

Set the correct time zone.

Visit on Web page
Select next: enter the database password

Next: the name is zabbix server

Next, start logging in. The user is Admin and the password is zabbix

We can choose Chinese by clicking this villain's Avatar:

Then select Configure host to see

New host

We only need one package to install agent on server 5 and 6
We directly pass the yum source to server56

yum install zabbix-agent.x86_64 -y
systemctl enable --now zabbix-agent.service 

Modify profile

vim /etc/zabbix/zabbix_agentd.conf  #Three amendments

systemctl restart zabbix-agent.service

Query port

netstat -antlp

If there is 10050, it will be opened successfully

There are three ways to add hosts

1. Add host manually

Select Linux servers for the group

Then select the template:
Select Template OS Linux in the link selector

Click Update directly after the change:
Configuration, host. When the status shown in the figure below appears, the data information in the view drawing indicates that the addition is successful,

2. Add host automatically

We need to use server6 just configured
Same as the previous server2 configuration
Action – > auto discovery – > start

The one on the far right is disabled. Click it to open it

Then the automatic discovery configuration is as follows:

The point update becomes like this

Then click auto discovery to find the server
Then we go to configure the host and check it. We can see that server3 is already in the host group

3. Automatic registration

In order to save resources, we directly delete the server6 just added, and then disable the automatically discovered rules
Now test automatic registration
Actions – > auto registration – > action hostname – > actions – > associated with adding to host group module

Click enable to turn auto discovery into disabled
Then, action, select automatic registration in the upper right corner
Select configuration, action!

Remember to add certain trigger conditions
Then click action
Insert picture description here and click New

Remember to add the key points after selecting the template
Then select a new template

Select two new templates and select update when finished

Let's go to the host to check whether the addition is successful. If it does not appear, restart the following services
Execute the following command on server6

systemctl restart zabbix-agent.service 

Still configuring the host, check:

Tags: Front-end Operation & Maintenance Zabbix server

Posted on Sun, 05 Dec 2021 15:19:35 -0500 by riddhi