完成主機配置後,在地端安裝監控軟體來獲取主機資訊,為了精確地獲取主機運作的資訊與數據,選擇用來監控主機的軟體是Zabbix,以下範例Zabbix-Server安裝步驟。
1.Zabbix-Download 可參考官網有提供簡易安裝步驟,作業系統使用CentOS7
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
2.清理緩存
yum clean all
3.下載Zabbix-Server、Zabbix-Agent
yum install zabbix-server-mysql zabbix-agent
4.安裝Zabbix前端
yum install centos-release-scl
vim /etc/yum.repos.d/zabbix.repo
將zabbix-frontend中enabled改為1
[zabbix-frontend]
name=Zabbix Official Repository frontend - $basearch
baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/frontend
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
5.下載Web套件
yum install zabbix-web-mysql-scl zabbix-apache-conf-scl
6.安裝MySql資料庫
yum install mariadb-server -y
7.配置資料庫
mysql -uroot -p
create database zabbix character set utf8 collate utf8_bin;
create user zabbix@localhost identified by 'password';
grant all privileges on zabbix.* to zabbix@localhost;
flush privileges;
exit
8.導入數據庫信息
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
9.進入資料庫確認是否正確導入
mysql -uzabbix -p
show databases;
use zabbix;
show tables;
如成功導入會出現成功信息
10.修改Zabbix-Server配置文件
vim /etc/zabbix/zabbix_server.conf
至DBPassword添加資料庫密碼,儲存退出
DBPassword=PassWord
11.添加時區
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
取消註解並添加
php_value[date.timezone] = Asia/tokyo
12.啟動Zabbix-Server
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm