前提條件:php
Zabbix部署(包含server,web,agent)html
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
yum clean all
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
配置zabbix數據庫服務(加優化)python
vi /etc/zabbix/zabbix_server.confmysql
DBHost=IPAddr DBName=zabbix DBUser=zabbix DBPassword=pssword DBPort=3306 ListenIP=127.0.0.1 StartPollers=100 StartPollersUnreachable=10 StartTrappers=10 StartPingers=10 StartDiscoverers=10 StartVMwareCollectors=3 CacheSize=512M StartDBSyncers=6 HistoryCacheSize=512M HistoryIndexCacheSize=512M TrendCacheSize=512M ValueCacheSize=1288M
取消備註,設置正確的時間linux
vi /etc/httpd/conf.d/zabbix.conf web
# php_value date.timezone Europe/Riga
php_value date.timezone Asia/Chongqing
關閉selinuxsql
vi /etc/selinux/config 數據庫
SELINUX=disabled
setenforce 0centos
修改httpd_can_network_connect值:app
getsebool -a | grep httpd #查看一下,值知否爲OFF
setsebool httpd_can_network_connect 1 #修改值爲on
傳輸配置文件至mysql數據庫中
scp /usr/share/doc/zabbix-server-mysql*/create.sql.gz root@10.0.10.34:
啓動服務並設置開機自啓
systemctl enable zabbix-server zabbix-agent httpd
systemctl restart zabbix-server zabbix-agent httpd
Mysql部署:
Mysql安裝請見:Mysql——安裝
新加數據庫和用戶:
create database zabbix character set utf8 collate utf8_bin; #建立一個zabbix的數據庫
CREATE USER 'zabbix'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; #建立一個用戶
GRANT ALL ON zabbix.* TO 'zabbix'@'localhost' WITH GRANT OPTION; #授予zabbix的遠程登陸權限。
flush privileges; #刷新權限
將從zabbix-Server傳送過來的配置文件導入進mysql中
zcat create.sql.gz | mysql -uzabbix -p zabbix
進入zabbix數據庫中查看一下是否存在
開啓服務,設置自啓動:
systemctl start mysqld
systemctl enable mysqld
systemctl daemon-reload