Zabbix4.0 is deployed in CentOS7
This article is completed by referring to official documents
https://www.zabbix.com/cn/download?zabbix=4.0&os_distribution=centos&os_version=7&db=mysql&ws=apache
Copy the code
(Click to enlarge the picture to view)
The environment that
- 1, the Zabbix Server. –
CentOS7.9 one VMware vm 192.168.31.232
- 2, Zabbix Agent
CentOS7.9 one VMware VM 192.168.31.127
1. Zabbix Server deployment
1, yum source +EPEL source configuration
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
Copy the code
When disabling SELINUX, calibrate the system time
yum install ntpdate -y
ntpdate ntp.aliyun.com
Copy the code
(Click to enlarge the picture to view)
2. Install Zabbix Server and Zabbix-agent using yum
The RPM - Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm yum install zabbix-server-mysql zabbix-web-mysql zabbix-agentCopy the code
(Click to enlarge the picture to view)
Install the MariaDB database and import zabbix to initialize the database
yum install mariadb-server
systemctl start mariadb.service
mysql_secure_installation
Copy the code
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
Create the Zabbix database
mysql -uroot -p
create database zabbix character set utf8 collate utf8_bin;
create user zabbix@localhost identified by 'zabbix@2021';
grant all privileges on zabbix.* to zabbix@localhost;
quit;
Copy the code
(Click to enlarge the picture to view)
Import Zabbix to initialize the database
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Copy the code
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
4. Change the database password in the configuration file
Vim /etc/zabbix/zabbix_server.conf Change DBPassword=zabbix@2021 and start systemctl restart zabbix-server zabbix-agent HTTPDCopy the code
(Click to enlarge the picture to view)
5. Modify the time zone in the configuration file
vi /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
Copy the code
(Click to enlarge the picture to view)
6. PHP. Ini configuration optimization
vim /etc/php.ini
date.timezone = Asia/Shanghai
max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_time = 300
max_input_vars = 10000
always_populate_raw_post_data = -1
Copy the code
(Click to enlarge the picture to view)
7. Start zabbix-server and set it to start automatically upon startup
systemctl enable httpd
systemctl enable zabbix-server
systemctl enable zabbix-agent
systemctl enable mariadb
firewall-cmd --permanent --zone=public --add-port=80/tcp
firewall-cmd --permanent --zone=public --add-port=10051/tcp
firewall-cmd --reload
Copy the code
(Click to enlarge the picture to view)
2. Complete the initialization wizard on the Zabbix-server Web page
http://192.168.31.127/zabbix/setup.php
Copy the code
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
Change the interface language to Chinese
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
Install and configure Zabbix Agent
1. Configure the yum source
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
Copy the code
(Click to enlarge the picture to view)
2. Install zabbix-Agent
The RPM - Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm yum install zabbix agentCopy the code
(Click to enlarge the picture to view)
3. Modify the configuration file
Modify the Server and ServerActive IP addresses in the configuration file
sed -i "s/Hostname=Zabbix server/Hostname=centos.walkingcloud.cn/g" /etc/zabbix/zabbix_agentd.conf sed -i "S/ServerActive = = 127.0.0.1 / ServerActive 192.168.31.232 / g"/etc/zabbix/zabbix_agentd conf sed - I "S/Server = 127.0.0.1 / Server = 192.168.31.232 / g"/etc/zabbix/zabbix_agentd conf cat/etc/zabbix/zabbix_agentd conf | grep Server= cat /etc/zabbix/zabbix_agentd.conf | grep ServerActive= cat /etc/zabbix/zabbix_agentd.conf | grep Hostname=Copy the code
(Click to enlarge the picture to view)
4. Start the zabbix-Agent service and set it to automatically start upon startup
Zabbix-agent needs to play port 10050 on the firewall
firewall-cmd --permanent --zone=public --add-port=10050/tcp
firewall-cmd --reload
systemctl enable zabbix-agent
systemctl start zabbix-agent
systemctl status zabbix-agent
tail -f /var/log/zabbix/zabbix_agentd.log
Copy the code
(Click to enlarge the picture to view)
4. Create a host group and add hosts
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
Tips: Solve garbled characters
Solution: Install font and replace existing font \
yum install wqy-microhei-fonts -y
cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/zabbix/assets/fonts/graphfont.ttf
Copy the code
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
5. Trigger alarm tests
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
(Click to enlarge the picture to view)
The alarm is generated when the available capacity is less than 80%. The alarm is generated when the in traffic exceeds 70Mbps
Summary: This article is just an initial introduction to the zabbix installation and deployment. Zabbix’s powerful monitoring capabilities will be explored later