您好,登錄后才能下訂單哦!
十一、使用Zabbix Proxy模式添加Linux主機(jī):
1、Zabbix Proxy分布式監(jiān)控簡單說明:
Zabbix Proxy收集各個Zabbix Agent的數(shù)據(jù),并將收集到的數(shù)據(jù)統(tǒng)一匯報給Zabbix Server
2、sh-proxy節(jié)點(diǎn)部署和zabbix-server節(jié)點(diǎn)一致的MySQL 5.7
3、sh-proxy節(jié)點(diǎn)創(chuàng)建zabbix_proxy數(shù)據(jù)庫和'zbxproxy'@'192.168.0.%'用戶,并授權(quán)'zbxproxy'@'192.168.0.%'用戶遠(yuǎn)程管理:
# mysql -uroot -p
mysql> create database zabbix_proxy character set utf8 collate utf8_bin;
mysql> create user 'zbxproxy'@'192.168.0.%' identified by '123456';
mysql> grant all on zabbix_proxy.* to 'zbxproxy'@'192.168.0.%';
mysql> flush privileges;
4、sh-proxy節(jié)點(diǎn)安裝zabbix-proxy-mysql軟件包:# yum -y install zabbix-proxy-mysql
5、sh-proxy節(jié)點(diǎn)導(dǎo)入schema.sql文件,初始化zabbix_proxy數(shù)據(jù)庫:
# zcat /usr/share/doc/zabbix-proxy-mysql-4.0.14/schema.sql.gz | mysql -uzbxproxy -h292.168.0.121 -p zabbix_proxy
6、sh-proxy節(jié)點(diǎn)修改zabbix_proxy.conf配置文件:
# cd /etc/zabbix
# cp zabbix_proxy.conf{,.bak}
# vim zabbix_proxy.conf
修改前 | 修改后 |
# ProxyMode=0 | ProxyMode=0 |
Server=127.0.0.1 | Server=192.168.0.120 |
# ServerPort=10051 | ServerPort=10051 |
Hostname=Zabbix proxy | Hostname=sh-proxy |
# ListenPort=10051 | ListenPort=10051 |
# LogType=file | LogType=file |
LogFile=/var/log/zabbix/zabbix_proxy.log | 保持默認(rèn) |
# DBHost=localhost | DBHost=192.168.0.121 |
DBName=zabbix_proxy | 保持默認(rèn) |
DBUser=zabbix | DBUser=zbxproxy |
# DBPassword= | DBPassword=123456 |
# DBSocket= | DBSocket=/var/lib/mysql/mysql.sock |
# DBPort= | DBPort=3306 |
# HeartbeatFrequency=60 | HeartbeatFrequency=60 |
# ConfigFrequency=3600 | ConfigFrequency=3600 |
# DataSenderFrequency=1 | DataSenderFrequency=1 |
# ListenIP=0.0.0.0 | ListenIP=192.168.0.121 |
ExternalScripts=/usr/lib/zabbix/externalscripts | 保持默認(rèn) |
# AllowRoot=0 | AllowRoot=0 |
# User=zabbix | User=zabbix |
7、sh-proxy節(jié)點(diǎn)啟動Zabbix Proxy:
# systemctl start zabbix-proxy
# systemctl status zabbix-proxy
# ps aux | grep zabbix_proxy
# ss -tunlp | grep -w 10051
# tail -100 /var/log/zabbix/zabbix_proxy.log
8、配置開機(jī)自啟:# systemctl enable zabbix-proxy
9、node-122節(jié)點(diǎn)修改zabbix_agentd.conf配置文件,將參數(shù)Server和ServerActive的值修改為sh-proxy節(jié)點(diǎn)所對應(yīng)的IP:
# vim /etc/zabbix/zabbix_agentd.conf
修改前 | 修改后 |
PidFile=/var/run/zabbix/zabbix_agentd.pid | 保持默認(rèn) |
# LogType=file | LogType=file |
LogFile=/var/log/zabbix/zabbix_agentd.log | 保持默認(rèn) |
LogFileSize=0 | 保持默認(rèn) |
# EnableRemoteCommands=0 | EnableRemoteCommands=1 |
Server=127.0.0.1 | Server=192.168.0.121 |
# ListenPort=10050 | ListenPort=10050 |
# ListenIP=0.0.0.0 | ListenIP=192.168.0.122 |
ServerActive=127.0.0.1 | ServerActive=192.168.0.121 |
Hostname=Zabbix server | Hostname=node-122 |
# AllowRoot=0 | AllowRoot=0 |
# User=zabbix | User=zabbix |
Include=/etc/zabbix/zabbix_agentd.d/*.conf | 保持默認(rèn) |
# UnsafeUserParameters=0 | UnsafeUserParameters=1 |
10、node-122節(jié)點(diǎn)重啟Zabbix Agent:# systemctl restart zabbix-agent
11、sh-proxy節(jié)點(diǎn)重啟Zabbix Proxy:# systemctl restart zabbix-proxy
12、sh-proxy節(jié)點(diǎn)使用zabbix-get進(jìn)行取值測試:
# yum -y install zabbix-get
# zabbix_get -s 192.168.0.122 -k system.uname
13、Zabbix Web新增proxy:
Administration --> Proxies --> Create proxy --> Add
14、Zabbix Web修改node-122節(jié)點(diǎn)“Monitored by proxy”的值為sh-proxy:
15、查看node-122節(jié)點(diǎn)最新監(jiān)控數(shù)據(jù):
16、sh-proxy節(jié)點(diǎn)安裝zabbix-agent軟件包:# yum -y install zabbix-agent
17、sh-proxy節(jié)點(diǎn)修改zabbix_agentd.conf配置文件:
# cd /etc/zabbix
# cp zabbix_agentd.conf{,.bak}
# vim zabbix_agentd.conf
修改前 | 修改后 |
PidFile=/var/run/zabbix/zabbix_agentd.pid | 保持默認(rèn) |
# LogType=file | LogType=file |
LogFile=/var/log/zabbix/zabbix_agentd.log | 保持默認(rèn) |
LogFileSize=0 | 保持默認(rèn) |
# EnableRemoteCommands=0 | EnableRemoteCommands=1 |
Server=127.0.0.1 | Server=192.168.0.121 |
# ListenPort=10050 | ListenPort=10050 |
# ListenIP=0.0.0.0 | ListenIP=192.168.0.121 |
ServerActive=127.0.0.1 | ServerActive=192.168.0.121 |
Hostname=Zabbix server | Hostname=sh-proxy |
# AllowRoot=0 | AllowRoot=0 |
# User=zabbix | User=zabbix |
Include=/etc/zabbix/zabbix_agentd.d/*.conf | 保持默認(rèn) |
# UnsafeUserParameters=0 | UnsafeUserParameters=1 |
說明:Server和ServerActive參數(shù)中配置的不是Zabbix Server的IP,而是Zabbix Proxy自己的IP
18、sh-proxy節(jié)點(diǎn)啟動Zabbix Agent:
# systemctl start zabbix-agent
# systemctl status zabbix-agent
# ps aux | grep zabbix_agent
# ss -tunlp | grep -w 10050
# tail -100 /var/log/zabbix/zabbix_agentd.log
19、配置開機(jī)自啟:# systemctl enable zabbix-agent
20、sh-proxy節(jié)點(diǎn)重啟Zabbix Proxy:# systemctl restart zabbix-proxy
21、Zabbix Web添加sh-proxy節(jié)點(diǎn):
Configuration --> Hosts --> Create host --> Add
22、sh-proxy節(jié)點(diǎn)鏈接Linux監(jiān)控模板:
23、查看sh-proxy節(jié)點(diǎn)最新監(jiān)控數(shù)據(jù):
?
?
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。