1. Zabbix简介

zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。

zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。

zabbix由2部分构成,zabbix server与可选组件zabbix agent。

zabbix server可以通过SNMP,zabbix-agent,ping,端口监视等方法提供对远程服务器/网络状态的监视,数据收集等功能,它可以运行在Linux,Solaris,HP-UX,AIX,FreeBSD,Open BSD,OS X等平台上。

2.服务器准备

2.1 主机信息+IP地址

#一台虚拟机
hostname:Zabbix-server
ip:server_ip_address


2.2 查看主机的系统版本信息

[root@Zabbix-server ~]#  cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core)


2.3关掉Selinux和配置防火墙

2.3.1 关掉Selinux

[root@Zabbix-server ~]#  setenforce 0  &&   getenforce
Permissive
[root@Zabbix-server ~]# sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/sysconfig/selinux
[root@Zabbix-server ~]# cat /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# disabled - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of disabled.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted


2.3.2 配置防火墙

[root@Zabbix-server ~]# firewall-cmd --state && firewall-cmd --list-ports
running
80/tcp

# 假设zabbix-agent端口为10050
[root@Zabbix-server ~]# firewall-cmd --zone=public --permanent --add-port=10050/tcp && firewall-cmd --reload && firewall-cmd --list-ports
success
success
80/tcp 10050/tcp

#假设zabbix-server端口为10051
[root@Zabbix-server ~]# firewall-cmd --zone=public --permanent --add-port=10051/tcp && firewall-cmd --reload && firewall-cmd --list-ports
success
success
80/tcp 10051/tcp 10050/tcp

#假设httpd端口为8480
[root@Zabbix-server ~]# firewall-cmd --zone=public --permanent --add-port=8480/tcp && firewall-cmd --reload && firewall-cmd --list-ports
success
success
80/tcp 10051/tcp 8480/tcp 10050/tcp


2.3.3 安装centos7网络yum源

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


3. 安装Zabbix-server需要的环境(LAMP: httpd服务+数据库服务+php)

3.1 LAMP介绍

LAMP:Linux+Apache+Mysql/MariaDB+Perl/PHP/Python一组常用来搭建动态网站或者服务器的开源软件,本身都是各自独立的程序,但是因为常被放在一起使用,拥有了越来越高的兼容度,共同组成了一个强大的Web应用程序平台。
LNMP:LNMP指的是一个基于CentOS/Debian编写的Nginx、PHP、MySQL、phpMyAdmin、eAccelerator一键安装包。可以在VPS、独立主机上轻松的安装LNMP生产环境。

3.2 安装apache也就是httpd服务

3.2.1 直接yum安装

[root@Zabbix-server tools]#  rpm -qa|grep httpd
[root@Zabbix-server tools]# yum install -y httpd
[root@Zabbix-server tools]# rpm -qa|grep httpd
httpd-2.4.6-97.el7.centos.x86_64
httpd-tools-2.4.6-97.el7.centos.x86_64


3.2.2 设置httpd服务开机自启动

[root@Zabbix-server tools]# systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.


3.2.3 修改httpd服务的默认监听端口80为8480

[root@Zabbix-server tools]# cd /etc/httpd/conf
[root@Zabbix-server conf]# vi httpd.conf +42
[root@Zabbix-server conf]# grep 8480 httpd.conf
Listen 8480


3.2.4 启动httpd服务

[root@Zabbix-server conf]# systemctl start httpd && echo $?
0
[root@Zabbix-server conf]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since 二 2021-01-19 12:42:20 CST; 1min 43s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 125278 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Main PID: 125293 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
├─125293 /usr/sbin/httpd -DFOREGROUND
├─125294 /usr/sbin/httpd -DFOREGROUND
├─125295 /usr/sbin/httpd -DFOREGROUND
├─125296 /usr/sbin/httpd -DFOREGROUND
├─125297 /usr/sbin/httpd -DFOREGROUND
└─125298 /usr/sbin/httpd -DFOREGROUND

1月 19 12:42:20 Zabbix-server systemd[1]: Starting The Apache HTTP Server...
1月 19 12:42:20 Zabbix-server httpd[125293]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, ...message
1月 19 12:42:20 Zabbix-server systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.

[root@Zabbix-server conf]# lsof -i:8480
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 125293 root 4u IPv6 6790155 0t0 TCP *:8480 (LISTEN)
httpd 125294 apache 4u IPv6 6790155 0t0 TCP *:8480 (LISTEN)
httpd 125295 apache 4u IPv6 6790155 0t0 TCP *:8480 (LISTEN)
httpd 125296 apache 4u IPv6 6790155 0t0 TCP *:8480 (LISTEN)
httpd 125297 apache 4u IPv6 6790155 0t0 TCP *:8480 (LISTEN)
httpd 125298 apache 4u IPv6 6790155 0t0 TCP *:8480 (LISTEN)


3.3 安装数据库—存储zabbix采集到的数据

3.3.1 直接yum或者rpm安装

注意:因为7版本的mysql要收费,所以我们这里安装mariadb代替mysql

[root@Zabbix-server tools] rpm -qa|grep  mariadb 
[root@Zabbix-server tools]# yum install -y mariadb mariadb-server
[root@Zabbix-server tools]# rpm -qa|grep mariadb
mariadb-libs-5.5.68-1.el7.x86_64
mariadb-server-5.5.68-1.el7.x86_64
mariadb-5.5.68-1.el7.x86_64


3.3.2 设置mysql服务开机自启动

[root@Zabbix-server tools]#  systemctl enable mariadb.service  
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.


3.3.3 启动mysql服务

[root@Zabbix-server ~]# systemctl start mariadb.service 
[root@Zabbix-server ~]# systemctl status mariadb.service
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since 二 2021-01-19 13:04:26 CST; 1h 21min ago
Main PID: 127665 (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─127665 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─127830 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/l...

1月 19 13:04:24 Zabbix-server systemd[1]: Starting MariaDB database server...
1月 19 13:04:24 Zabbix-server mariadb-prepare-db-dir[127630]: Database MariaDB is probably initialized in /var/lib/mysql already, noth...done.
1月 19 13:04:24 Zabbix-server mariadb-prepare-db-dir[127630]: If this is not the case, make sure the /var/lib/mysql is empty before ru...-dir.
1月 19 13:04:24 Zabbix-server mysqld_safe[127665]: 210119 13:04:24 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
1月 19 13:04:24 Zabbix-server mysqld_safe[127665]: 210119 13:04:24 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
1月 19 13:04:26 Zabbix-server systemd[1]: Started MariaDB database server.
Hint: Some lines were ellipsized, use -l to show in full.

[root@Zabbix-server ~]# lsof -i:3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 127830 mysql 14u IPv4 6797577 0t0 TCP *:mysql (LISTEN)

[root@Zabbix-server ~]# mysql #默认是没有密码的
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> select version();
+----------------+
| version() |
+----------------+
| 5.5.60-MariaDB |
+----------------+
1 row in set (0.00 sec)

MariaDB [(none)]> exit;
Bye


3.3.4初始化 mariadb 并配置 root 密码

注意:要先输入当前密码,一般初次安装的默认密码为空

[root@zabbix-server ~]# mysql_secure_installation 

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]
... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]
... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]
... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!


4. 正式安装Zabbix-server

注意:zabbix-server也要监控自身,所以也要同时安装zabbix-agent

4.1 下载zabbix的rpm安装包并进行安装

[root@Zabbix-server tools]# rpm -qa|grep zabbix
[root@Zabbix-server ~]# cd /home/tools/ && wget https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm

[root@Zabbix-server tools]# ll zabbix-release-5.0-1.el7.noarch.rpm
-rw-r--r--. 1 root root 14532 5月 11 2020 zabbix-release-5.0-1.el7.noarch.rpm

[root@Zabbix-server tools]# ll /etc/yum.repos.d/
总用量 38
-rw-r--r--. 1 root root 1664 12月 9 2015 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 12月 9 2015 CentOS-CR.repo
-rw-r--r--. 1 root root 649 12月 9 2015 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 290 12月 9 2015 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 12月 9 2015 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 12月 9 2015 CentOS-Sources.repo
-rw-r--r--. 1 root root 1952 12月 9 2015 CentOS-Vault.repo
-rw-r--r--. 1 root root 951 10月 3 2017 epel.repo
-rw-r--r--. 1 root root 1050 10月 3 2017 epel-testing.repo

[root@Zabbix-server tools]# yum install -y zabbix-release-5.0-1.el7.noarch.rpm
[root@Zabbix-server tools]# rpm -qa|grep zabbix
zabbix-release-5.0-1.el7.noarch
[root@Zabbix-server tools]# ll /etc/yum.repos.d/
总用量 40
-rw-r--r--. 1 root root 1664 12月 9 2015 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 12月 9 2015 CentOS-CR.repo
-rw-r--r--. 1 root root 649 12月 9 2015 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 290 12月 9 2015 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 12月 9 2015 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 12月 9 2015 CentOS-Sources.repo
-rw-r--r--. 1 root root 1952 12月 9 2015 CentOS-Vault.repo
-rw-r--r--. 1 root root 951 10月 3 2017 epel.repo
-rw-r--r--. 1 root root 1050 10月 3 2017 epel-testing.repo
-rw-r--r--. 1 root root 853 5月 11 2020 zabbix.repo ###安装rpm包之后产生的###


4.2 鉴于国内网络情况,将zabbix官方下载源替换成阿里云的

[root@Zabbix-server tools]# sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo


4.3 安装 zabbix-server-mysql 和 zabbix-agent

[root@Zabbix-server tools]# yum install zabbix-server-mysql zabbix-agent -y
[root@Zabbix-server tools]# rpm -qa |grep zabbix
zabbix-server-mysql-5.0.7-1.el7.x86_64
zabbix-release-5.0-1.el7.noarch
zabbix-agent-5.0.7-1.el7.x86_64


4.4 安装 Software Collections

注意: 安装 Software Collections是便于后续安装高版本的 php,默认 yum 安装的 php 版本为 5.4 过低。

[root@Zabbix-server tools]# rpm -qa |grep centos-release-scl 
[root@Zabbix-server tools]# yum install centos-release-scl -y
[root@Zabbix-server tools]# rpm -qa |grep centos-release-scl
centos-release-scl-rh-2-3.el7.centos.noarch
centos-release-scl-2-3.el7.centos.noarch
[root@Zabbix-server tools]# ll /etc/yum.repos.d/
总用量 48
-rw-r--r--. 1 root root 1664 12月 9 2015 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 12月 9 2015 CentOS-CR.repo
-rw-r--r--. 1 root root 649 12月 9 2015 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 290 12月 9 2015 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 12月 9 2015 CentOS-Media.repo
-rw-r--r--. 1 root root 998 12月 11 2018 CentOS-SCLo-scl.repo ###新产生的###
-rw-r--r--. 1 root root 971 10月 29 2018 CentOS-SCLo-scl-rh.repo ###新产生的###
-rw-r--r--. 1 root root 1331 12月 9 2015 CentOS-Sources.repo
-rw-r--r--. 1 root root 1952 12月 9 2015 CentOS-Vault.repo
-rw-r--r--. 1 root root 951 10月 3 2017 epel.repo
-rw-r--r--. 1 root root 1050 10月 3 2017 epel-testing.repo
-rw-r--r--. 1 root root 897 1月 19 12:35 zabbix.repo


4.5 修改 /etc/yum.repos.d/zabbix.repo

启用下载 zabbix 的前端源,将[zabbix-frontend]下的 enabled 改为 1

[root@Zabbix-server tools]# vi /etc/yum.repos.d/zabbix.repo


4.6 安装 zabbix 前端和php相关环境

[root@Zabbix-server tools]# yum install zabbix-web-mysql-scl zabbix-apache-conf-scl -y 

[root@Zabbix-server tools]# rpm -qa |grep zabbix
zabbix-release-5.0-1.el7.noarch
zabbix-agent-5.0.7-1.el7.x86_64
zabbix-web-mysql-scl-5.0.7-1.el7.noarch #####
zabbix-apache-conf-scl-5.0.7-1.el7.noarch #####
zabbix-server-mysql-5.0.7-1.el7.x86_64
zabbix-web-5.0.7-1.el7.noarch #####
zabbix-web-deps-scl-5.0.7-1.el7.noarch #####


执行上面的命令时rh-php72-php作为依赖被安装

[root@Zabbix-server tools]#  rpm -qa |grep rh-php72-php   
rh-php72-php-zip-7.2.24-1.el7.x86_64
rh-php72-php-process-7.2.24-1.el7.x86_64
rh-php72-php-mysqlnd-7.2.24-1.el7.x86_64
rh-php72-php-mbstring-7.2.24-1.el7.x86_64
rh-php72-php-xml-7.2.24-1.el7.x86_64
rh-php72-php-bcmath-7.2.24-1.el7.x86_64
rh-php72-php-json-7.2.24-1.el7.x86_64
rh-php72-php-cli-7.2.24-1.el7.x86_64
rh-php72-php-gd-7.2.24-1.el7.x86_64
rh-php72-php-fpm-7.2.24-1.el7.x86_64
rh-php72-php-pdo-7.2.24-1.el7.x86_64
rh-php72-php-ldap-7.2.24-1.el7.x86_64
rh-php72-php-common-7.2.24-1.el7.x86_64
rh-php72-php-pear-1.10.5-1.el7.noarch


4.7 设置服务开机自启动

[root@Zabbix-server zabbix]# systemctl enable  rh-php72-php-fpm 
[root@Zabbix-server zabbix]# systemctl enable zabbix-server.service
[root@Zabbix-server zabbix]# systemctl enable zabbix-agent.service


4.8 使用 root 用户进入 mysql,并建立 zabbix 数据库,注意数据库编码

[root@Zabbix-server ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.68-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> create user zabbix@localhost identified by 'zabbix123456'; ##这里和后面配置文件设置密码保持一致##
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost;
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| ejucms |
| mysql |
| performance_schema |
| zabbix |
+--------------------+


4.9 向zabbix库导入表 — 初始化zabbix数据

[root@Zabbix-server ~]# rpm -qa |grep zabbix-server-mysql
zabbix-server-mysql-5.0.7-1.el7.x86_64
[root@Zabbix-server ~]# rpm -ql zabbix-server-mysql
/etc/logrotate.d/zabbix-server
/etc/zabbix/zabbix_server.conf
/usr/lib/systemd/system/zabbix-server.service
/usr/lib/tmpfiles.d/zabbix-server.conf
/usr/lib/zabbix/alertscripts
/usr/lib/zabbix/externalscripts
/usr/sbin/zabbix_server_mysql
/usr/share/doc/zabbix-server-mysql-5.0.7
/usr/share/doc/zabbix-server-mysql-5.0.7/AUTHORS
/usr/share/doc/zabbix-server-mysql-5.0.7/COPYING
/usr/share/doc/zabbix-server-mysql-5.0.7/ChangeLog
/usr/share/doc/zabbix-server-mysql-5.0.7/NEWS
/usr/share/doc/zabbix-server-mysql-5.0.7/README
/usr/share/doc/zabbix-server-mysql-5.0.7/create.sql.gz #######
/usr/share/doc/zabbix-server-mysql-5.0.7/double.sql
/usr/share/man/man8/zabbix_server.8.gz
/var/log/zabbix
/var/run/zabbix

[root@Zabbix-server ~]# cd /usr/share/doc/zabbix-server-mysql-5.0.7/
[root@Zabbix-server zabbix-server-mysql-5.0.7]# ll
总用量 2784
-rw-r--r--. 1 root root 98 12月 14 18:27 AUTHORS
-rw-r--r--. 1 root root 1165388 12月 21 17:38 ChangeLog
-rw-r--r--. 1 root root 17990 12月 14 18:27 COPYING
-rw-r--r--. 1 root root 1644549 12月 21 18:24 create.sql.gz ###也可以先使用gunzip命令解压再导入###
-rw-r--r--. 1 root root 282 12月 14 18:27 double.sql
-rw-r--r--. 1 root root 52 12月 14 18:27 NEWS
-rw-r--r--. 1 root root 1317 12月 14 18:27 README

[root@Zabbix-server zabbix-server-mysql-5.0.7]# zcat /usr/share/doc/zabbix-server-mysql-5.0.7/create.sql.gz | mysql -uzabbix -p zabbix
Enter password:
[root@Zabbix-server zabbix-server-mysql-5.0.7]# echo $?
0


4.10 修改/etc/zabbix/zabbix_server.conf 配置文件

[root@Zabbix-server zabbix-server-mysql-5.0.7]# cd /etc/zabbix/
[root@Zabbix-server zabbix]# ll
总用量 40
drwxr-xr-x. 2 apache apache 32 1月 19 12:40 web
-rw-r--r--. 1 root root 15101 12月 21 18:27 zabbix_agentd.conf
drwxr-xr-x. 2 root root 6 12月 21 18:27 zabbix_agentd.d
-rw-r-----. 1 root zabbix 21531 12月 21 18:27 zabbix_server.conf


配置文件修改前:

[root@Zabbix-server zabbix]#  egrep -v "^$|^#"  zabbix_server.conf 
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBName=zabbix
DBUser=zabbix
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
StatsAllowedIP=127.0.0.1


配置文件修改后:

将文件中91行及124行(取消注释并修改内容)

[root@Zabbix-server zabbix]#  egrep -v "^$|^#"  zabbix_server.conf 
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBHost=localhost ###主机连接地址 第91行###
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix123456 ### 设置数据库密码 第124行###
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
StatsAllowedIP=127.0.0.1


4.11 修改/etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf 配置文件

[root@Zabbix-server zabbix]# vi  /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf 
#最后一行添加以下内容修改时区
php_value[date.timezone] = Asia/Shanghai


4.12 启动相关服务

[root@Zabbix-server zabbix]# systemctl restart mariadb.service 
[root@Zabbix-server zabbix]# systemctl restart httpd
[root@Zabbix-server zabbix]# systemctl restart rh-php72-php-fpm
[root@Zabbix-server zabbix]# systemctl restart zabbix-server.service
[root@Zabbix-server zabbix]# systemctl restart zabbix-agent.service


4.13 检查相关服务启动是否正常

[root@Zabbix-server tools]# netstat -lntup 
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1461/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1693/master
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 128031/zabbix_agent
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 128039/zabbix_serve
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 128029/php-fpm: mas
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 127830/mysqld
tcp 0 0 0.0.0.0:8480 0.0.0.0:* LISTEN 21789/nginx: master
tcp6 0 0 :::22 :::* LISTEN


5、zabbix-server web端配置

登录地址:​​http://IP:8480/zabbix/setup.php​