server端(ip 192.168.200.15)php
proxy端(ip 192.168.200.22)html
agent端(ip 192.168.200.12)mysql
server端: web
#安裝數據庫sql
[mariadb] name=MariaDB baseurl=http://mirrors.ustc.edu.cn/mariadb/yum/10.3/centos7-amd64/ gpgkey=http://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB gpgcheck=1 yum -y install MariaDB systemctl restart mysql systemctl enable mariadb
#安裝zabbix數據庫
https://www.zabbix.com/download?zabbix=4.2&os_distribution=centos&os_version=7&db=mysql rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
#建立數據庫vim
mysql -uroot -proot
mysql> create database zabbix ;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql> quit;
#導入zabbix服務器所須要的表和數據centos
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix zabbix
#編輯文件瀏覽器
vim /etc/zabbix/zabbix_server.conf
DBPassword=zabbix
#編輯文件設置時區服務器
vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai(打開註釋)
#啓動服務和開機自啓
systemctl restart zabbix-server zabbix-agent httpd
systemctl enable zabbix-server zabbix-agent httpd
firewall-cmd --add-port=10051/tcp --permanent
firewall-cmd --add-port=10050/tcp --permanent
#瀏覽器訪問
192.168.200.15/zabbix
proxy端:
#安裝數據庫
[mariadb] name=MariaDB baseurl=http://mirrors.ustc.edu.cn/mariadb/yum/10.3/centos7-amd64/ gpgkey=http://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB gpgcheck=1 systemctl restart mysql systemtl enable mariadb
#安裝zabbix組件
yum -y install zabbix-proxy
#編輯文件
vim /etc/zabbix/zabbix_proxy.conf
Server=192.168.254.15
Hostname=Zabbix proxy
DBName=zabbix_proxy
DBUser=zabbix
DBPassword=zabbix
#重啓服務
service zabbix-proxy restart
firewall-cmd --add-port=10051/tcp --permanent
firewall-cmd --add-port=10050/tcp --permanent
#建立數據庫和用戶
create database zabbix_proxy ;
grant all privileges on zabbix_proxy.* to zabbix@localhost identified by 'zabbix';
#解壓縮文件到數據庫中
zcat /usr/share/doc/zabbix-proxy-mysql-*/schema.sql.gz | mysql -uzabbix -pzabbix zabbix_proxy
agent端:
#修改agent端配置文件
vim /etc/zabbix/zabbix-agent.conf
Server=192.168.254.22
ServerActive=192.168.254.22
Hostname=class
#重啓客戶端
systemctl restart zabbix-agent
firewall-cmd --add-port=10050/tcp --permanent