一、部署思路整理:
1、Zabbix依賴LAMP環境,首先完成LAMP環境初始化,主要的一點是數據庫的zabbix用戶創建。
2、Zabbix本身的部署,主要是兩部分:一、zabbix的官方yum repo包,二、zabbix的官方數據庫導入
二、部署過程:
1、安裝LAMP環境
1.1、apache
yum -y install httpd
1.2、mariadb
yum -y install mariadb*
1.3、php
yum -y install php-mysql
2、初始化環境
1.1、apache
systemctl enable httpd
systemctl restart httpd
去瀏覽器測試本機地址

1.2、mariadb
systemctl enable mariadb
systemctl restart mariadb
mysql_secure_installation
Enter current password for root (enter for none):
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
mysql -uroot -proot
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
flush privileges;
3、安裝Zabbix
3.1、下載Zabbix的yum源包
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
yum clean all
3.2、安裝Zabbix server, frontend, agent
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
3.3、導入Zabbix數據庫
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
查看數據庫導入
mysql -uzabbix -pzabbix
show databases;
是否已經有了zabbix數據庫
3.4、修改Zabbix配置文件
vim /etc/zabbix/zabbix_server.conf
DBPassword=zabbix#125行
預覽Zabbix配置項
grep -n '^'[a-Z] /etc/zabbix/zabbix_server.conf
‘’‘
38:LogFile=/var/log/zabbix/zabbix_server.log
49:LogFileSize=0
72:PidFile=/var/run/zabbix/zabbix_server.pid
82:SocketDir=/var/run/zabbix
100:DBName=zabbix
116:DBUser=zabbix
125:DBPassword=zabbix
357:SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
474:Timeout=4
517:AlertScriptsPath=/usr/lib/zabbix/alertscripts
528:ExternalScripts=/usr/lib/zabbix/externalscripts
564:LogSlowQueries=3000
’‘’
3.5、修改Zabbix時區
vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai #20行
3.6、啟動Zabbix、agent,重啟apache
systemctl enable zabbix-server zabbix-agent
systemctl restart zabbix-server zabbix-agent httpd
4、Zabbix界面配置
4.1、

4.2、

4.3、

4.4、

4.5、

4.6、

4.7、

4.8、

三、安裝過程中可能遇到的問題:
1、httpd服務器起不來:
簡單部署zabbix是不需要對httpd的配置文件做任何改動的,主要的可能是Linux下的防火牆與Selinux。
2、zabbix的數據庫導入不成功:
在建立zabbix數據庫賬號的時候,對zabbix用戶賦權,如果只是對@localhost本地賦權,導入數據庫時只需要追加mysql -uzabbix -p zabbix命令
如果對zabbix用戶賦權時采用的時@%的遠程賦權,導入時需要指定zabbix服務器IP地址,mysql -uzabbix -h x.x.x.x -p zabbix
3、待追加~~~~~~~~~~~~~
