Table of contents
2. Zabbix monitoring principle
The first step is to turn off the firewall and security mechanism
The second step is to obtain the Zabbix download source
The third step is to replace the Zabbix Ali source
Step 4: Install dependent environments
Step 6 Modify the source configuration file
Step 7 Install Zabbix dependency environment
Step 8 Install the database required by Zabbix
Step 9: Initialize the database and set the password
Step 11 Create the database and operate it
Step 12 Import database information
Step 13 Modify Zabbix configuration file
Step 14 Modify the configuration file
Step 15: Start Zabbix related services
Step 15: Use the browser to access the test
The first step is to turn off the firewall and security mechanism
The second step is to install NTP time synchronization
Step 3: Synchronize client and server time
Step 4: Configure the time zone to be consistent with the server
Step 5 Configure Zabbix download source
Step 6 Configure source files and install
Step 7 Modify Zabbix configuration file
Step 9 Check whether the port is started successfully
Step 10: Install the data acquisition command on the server
Step 11: Test the connection to the client on the server side
1. Zabbix concept
●zabbix is an enterprise-level open source solution based on Web interface that provides distributed system monitoring and network monitoring functions.
●zabbix can monitor various network parameters to ensure the safe operation of the server system; and provides a flexible notification mechanism to allow system administrators to quickly locate/solve various existing problems.
●Zabbix consists of 2 parts, zabbix server and optional component zabbix agent. Data is collected through C/S mode and displayed and configured on the Web through B/S mode.
●zabbix server can provide remote server/network status monitoring, data collection and other functions through SNMP, zabbix agent, ping, port monitoring and other methods. It can run on platforms such as Linux.
●zabbix agent needs to be installed on the monitored target server. It mainly collects hardware information or operating system-related memory, CPU and other information.
●Browse all server status of the entire website through a friendly interface
●Monitoring data can be easily viewed on the Web front-end
●Can look back to find system problems and alarm situations when the accident occurred
2. Zabbix monitoring principle
The zabbix agent is installed on the monitored host. The zabbix agent is responsible for regularly collecting various local data on the client and sending it to the zabbix server. After the zabbix server receives the data, it stores the data in the database. The user can see it based on the Zabbix WEB The data is displayed as an image on the front end. When zabbix monitors a specific project, the project will set a trigger threshold. When the monitored indicator exceeds the threshold set by the trigger, some necessary actions will be taken. The actions include: sending information (email, WeChat, SMS ), send commands (shell commands, reboot, restart, install, etc.).
Zabbix monitoring is deployed in the system and includes five common programs: zabbix_server, zabbix_agent, zabbix_proxy, zabbix_get, zabbix_sender, etc.
●zabbix server: zabbix server daemon, in which the data of zabbix_agent, zabbix_get, zabbix_sender, and zabbix_proxy are finally submitted to zabbix server;
●zabbix agent: client daemon, responsible for collecting client data, such as collecting CPU load, memory, hard disk usage, etc.;
●zabbix proxy: zabbix distributed proxy daemon, usually more than 500 hosts, requires distributed monitoring architecture deployment;
●zabbix get: zabbix data receiving tool, a command used alone, usually executed on the server or proxy side to obtain remote client information;
●zabbix sender: Zabbix data sending tool. Users send data to the server or proxy. Usually it takes a long time for users to check.
3. Deploy Zabbix service
The first step is to turn off the firewall and security mechanism
Instruction: systemctl stop firewalld
setenforce 0
The second step is to obtain the Zabbix download source
Command: rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
The third step is to replace the Zabbix Ali source
命令:cd /etc/yum.repos.d
sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' zabbix.repoyum clean all && yum makecache
Step 4: Install dependent environments
命令:yum install -y zabbix-server-mysql zabbix-agent
Step 5 Install SCL service
Instruction: yum install -y centos-release-scl
Step 6 Modify the source configuration file
Command: vim /etc/yum.repos.d/zabbix.repo
Step 7 Install Zabbix dependency environment
命令:yum install -y zabbix-web-mysql-scl zabbix-apache-conf-scl
Step 8 Install the database required by Zabbix
Command: yum install -y mariadb-server mariadb
Step 9: Initialize the database and set the password
Instruction: systemctl enable --now mariadb
mysql_secure_installation
Step 10: Test login database
Command: mysql -u root -p[password]
Step 11 Create the database and operate it
命令:CREATE DATABASE zabbix character set utf8 collate utf8_bin;
GRANT all ON zabbix.* TO 'zabbix'@'%' IDENTIFIED BY 'zabbix';
flush privileges;
Step 12 Import database information
Command: zcat /usr/share/doc/zabbix-server-mysql-5.0.24/create.sql.gz | mysql -uroot -pabc123 zabbix
Step 13 Modify Zabbix configuration file
Command: vim /etc/zabbix/zabbix_server.conf
Step 14 Modify the configuration file
Command: vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
Step 15: Start Zabbix related services
命令:systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
Step 15: Use the browser to access the test
4. Deploy Zabbix client
The first step is to turn off the firewall and security mechanism
Instruction: systemctl stop firewalld
setenforce 0
The second step is to install NTP time synchronization
Command: yum install -y ntpdate
Step 3: Synchronize client and server time
Command: ntpdate -u ntp.aliyun.com
Step 4: Configure the time zone to be consistent with the server
命令:mv /etc/localtime{,.bak}
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtimedate
Step 5 Configure Zabbix download source
Command: rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
Step 6 Configure source files and install
命令:cd /etc/yum.repos.d
sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repoyum install -y zabbix-agent2
Step 7 Modify Zabbix configuration file
Command: vim /etc/zabbix/zabbix_agent2.conf
Step 8 Start the service
命令:systemctl start zabbix-agent2
systemctl enable zabbix-agent2
Step 9 Check whether the port is started successfully
Command: lsof -i:10050
Step 10: Install the data acquisition command on the server
Command: yum install -y zabbix-get
Step 11: Test the connection to the client on the server side
Command: zabbix_get -s '192.168.8.200' -p 10050 -k 'agent.ping'
zabbix_get -s '192.168.8.200' -p 10050 -k 'system.hostname'