zabbix軟體組成
zabbix-server: 監控服務端
zabbix-agent: 監控客戶端
zabbix-web: 監控網站服務
php: 處理動態請求
mysql: 資料庫存盤監控資料
zabbix: 負責收集agent資訊匯總告知zabbix-server
關閉防火墻和selinux
setenforce 0
sed -ri '/^SELINUX=/cSELINUX=disabled' /etc/sysconfig/selinux
systemctl stop firewalld ; systemctl disable firewalld
在清華源下載鏡像
https://mirrors.tuna.tsinghua.edu.cn/


添加zabbix源和epel源
下載安裝
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
安裝zabbix和相關服務組建
資料庫用my-sql所以用zabbix-web-mysql
--下載 zabbix-server-mysql
wget https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/{zabbix-server-mysql-4.0.20-1.el7.x86_64.rpm,zabbix-web-4.0.22-1.el7.noarch.rpm}
--安裝 zabbix-server-mysql
yum install -y httpd php zabbix-server-mysql-4.0.20-1.el7.x86_64.rpm zabbix-web-mysql
--安裝mariadb資料庫軟體
yum install -y mariadb-server
systemctl enable mariadb
資料庫配置
--初始化資料庫
systemctl start mariadb
mysql_secure_installation
(enter for none): 密碼為空,直接回車
Set root password?[Y/N]y 設定root 密碼
Remove anonymous users?[Y/n]y 洗掉匿名用戶
Disallow root login remotely?[Y/N]Y 允許遠程登錄
Remove test database....[Y/N] n 跳過測驗庫洗掉
Reload privilege tables now [Y/N] Y重新加載表權限
--進入資料庫
mysql -uroot -p
--創建資料庫
create database zabbix character set utf8 collate utf8_bin;
--zabbix用戶賦權
grant all privileges on zabbix.* to zabbix@localhost identified by '123456'
退出 quit
--匯入zabbix初始架構資料 回
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Enter password:123456
配置zabbix連接資料庫
--配置zabbix資料庫密碼
sed -ri.bak '/# DBPassword=/cDBPassword=123456' /etc/zabbix/zabbix_server.conf
或者
vim /etc/zabbix/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=123456
--配置時區
sed -ri.bak 's/ #(.*)date.timezone.*/\1date.timezone Asia\/Shanghai/' /etc/httpd/conf.d/zabbix.conf
啟動zabbix-server
systemctl start zabbix-server.service
systemctl enable zabbix-server.service
ss -ntpl |grep Zabbix
啟動httpd服務
systemctl start httpd
systemctl enable httpd
重啟mariadb資料庫
systemctl restart mariadb
web訪問
http://host/zabbix/setup.php




后續補充 被監控端部署
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/254853.html
標籤:其他
上一篇:Linux小實驗——設備掛載、磁盤磁區、格式化、RAID的配置、LVM配置、磁盤配額的配置方法和驗證
下一篇:Linux-基礎指令(二)
