1.1 部署zabbix
1.1.1 關(guān)閉防火墻和selinux
#關(guān)閉firewalld centos7
systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld
#關(guān)閉selinux
sed -i.bak 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
grep SELINUX=disabled /etc/selinux/config
setenforce 0
getenforce
1.1.2 安裝 zabbix 服務(wù)端
##step 1 下載安裝zabbix yum源文件
#官方y(tǒng)um源
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum clean all
##step 2 下載安裝zabbix服務(wù)端相關(guān)軟件
#zabbix服務(wù)程序軟件: zabbix-server-mysql
#zabbix客戶端軟件 zabbix-agent
yum install zabbix-server-mysql zabbix-agent
##step3 安裝Zabbix frontend
yum install centos-release-scl
##step4 編輯配置文件 /etc/yum.repos.d/zabbix.repo and enable zabbix-frontend repository.
[zabbix-frontend]
...
enabled=1
...
##step5 安裝Zabbix frontend packages.
yum install zabbix-web-mysql-scl zabbix-apache-conf-scl
##step6 安裝Mysql數(shù)據(jù)庫
cd /usr/local/src/
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
yum -y install mysql-server
##step7 配置數(shù)據(jù)庫
#啟動數(shù)據(jù)庫
systemctl start mysql
#修改數(shù)據(jù)庫默認(rèn)密碼
[root@localhost ~]# grep 'temporary password' /var/log/mysqld.log
2021-02-10T05:25:40.016192Z 1 [Note] A temporary password is generated for root@localhost: :QtQ+Vpdh1>Q
mysql -uroot -p: :QtQ+Vpdh1>Q
mysql>ALTER USER 'root'@'localhost' IDENTIFIED BY nWoo>o0rXtr4';
#創(chuàng)建zabbix數(shù)據(jù)庫
mysql> create database zabbix character set utf8 collate utf8_bin;
#創(chuàng)建zabbix mysql賬戶
mysql> create user zabbix@localhost identified by 'nWoo>o0rXtr4';
#將在zabbix數(shù)據(jù)庫授權(quán)給zabbix賬戶
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> quit;
#在zabbix數(shù)據(jù)庫中導(dǎo)入相應(yīng)的表信息
zcat /usr/share/doc/zabbix-server-mysql-4.0.28/create.sql.gz |mysql -uzabbix -pnWoo>o0rXtr4 zabbix
##step 8 軟件配置
#修改126行
vim /etc/zabbix/zabbix_server.conf
126 DBPassword=password
#修改21行
vim /etc/httpd/conf.d/zabbix.conf
21 php_value date.timezone Asia/Shanghai
##step 9 啟動zabbix相關(guān)服務(wù)
systemctl start zabbix-server.service httpd zabbix-agent
systemctl enable zabbix-server.service httpd mysql zabbix-agent
##登錄zabbix服務(wù)web頁面
http://172.17.0.101/zabbix/setup.php
用戶名Admin 密碼zabbix
# 記錄web頁面初始化信息的文件
/etc/zabbix/web/zabbix.conf.php
10051 zabbix-server 服務(wù)端端口號
10050 zabbix-agent 客戶端端口號
1.1.3 安裝zabbix客戶端
##step 1 下載安裝zabbix yum源文件
#官方y(tǒng)um源
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum clean all
#step 2 下載安裝zabbix客戶端軟件
yum install -y zabbix-agent
#step 3 編寫zabbix客戶端配置文件
#編寫98行 服務(wù)端地址
vim /etc/zabbix/zabbix_agentd.conf
98 Server=172.16.1.71