1.关闭防火墙及selinux
systemctl stop firewalld.service
systemctl disable firewalld.service
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
grep SELINUX=disabled /etc/selinux/config
setenforce 0
2.安装mysql 并配置数据库
create database zabbix character set utf8 ;
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
grant all privileges on zabbix.* to zabbix@'%' identified by 'zabbix';
3.下载Zabbix3.4 并安装
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
yum install zabbix-server-mysql zabbix-web-mysql -y
4.导入数据
zcat /usr/share/doc/zabbix-server-mysql-3.4.10/create.sql.gz | mysql -uzabbix -pzabbix zabbix
5.配置数据库用户及密码
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
91:DBHost=192.168.56.10
101:DBName=zabbix
117:DBUser=zabbix
125:DBPassword=zabbix
330:SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
448:Timeout=4
490:AlertScriptsPath=/usr/lib/zabbix/alertscripts
500:ExternalScripts=/usr/lib/zabbix/externalscripts
536:LogSlowQueries=3000
6.启动zabbix server并设置开机启动
systemctl enable zabbix-server
systemctl start zabbix-server
7.编辑Zabbix前端PHP配置,更改时区
vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
8.SELinux配置
setsebool -P httpd_can_connect_zabbix on
setsebool -P httpd_can_network_connect_db on
9.启动httpd并设置开机启动
systemctl start httpd
systemctl enable httpd
10.安装Zabbix Web
浏览器访问,并进行安装
http://192.168.190.61/zabbix/
默认用户Admin 默认密码zabbix
11.zabbxi-agent安装及配置
安装zabbxi-agent
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
yum install zabbix-agent -y
12.配置zabbxi-agent
grep -n '^'[a-Z] /etc/zabbix/zabbix_agentd.conf
13:PidFile=/var/run/zabbix/zabbix_agentd.pid
32:LogFile=/var/log/zabbix/zabbix_agentd.log
43:LogFileSize=0
97:Server=172.16.8.254
138:ServerActive=172.16.8.254
149:Hostname=testdb
267:Include=/etc/zabbix/zabbix_agentd.d/*.conf
13.启动zabbxi-agent并设置开机启动
systemctl enable zabbix-agent.service
systemctl restart zabbix-agent.service