1、zabbix官網對proxy的介紹node
A Zabbix proxy can collect performance and availability data on behalf of the Zabbix server. This way, a proxy can take on itself some of the load of collecting data and offload the Zabbix server.mysql
Also, using a proxy is the easiest way of implementing centralized and distributed monitoring, when all agents and proxies report to one Zabbix server and all data is collected centrally.web
A Zabbix proxy can be used to:sql
The proxy requires only one TCP connection to the Zabbix server. This way it is easier to get around a firewall as you only need to configure one firewall rule.數據庫
Zabbix proxy must use a separate database. Pointing it to the Zabbix server database will break the configuration.安全
All data collected by the proxy is stored locally before transmitting it over to the server. This way no data is lost due to any temporary communication problems with the server. The ProxyLocalBuffer and ProxyOfflineBuffer parameters in the proxy configuration file control for how long the data are kept locally.服務器
2、zabbix官網對node的介紹網絡
You can use nodes to build a hierarchy of distributed monitoring.架構
Each node is a full Zabbix server and is responsible for monitoring its own location. Zabbix supports up to a thousand nodes in a distributed setup.app
The benefits of using a node setup:
3、zabbix proxy安裝
#./configure --prefix=/usr/local/zabbix --enable-agent --enable-proxy --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl //--prefix指定zabbix安裝目錄,--enable-server 支持zabbix服務器 --enable-agent支持zabbix代理 --enable-proxy 支持zabbix代理服務器 --with-mysql 使用MySQL客戶端庫能夠選擇指定路徑mysql_config --with-net-snmp 使用net - snmp軟件包,擇性地指定路徑NET - SNMP配置 --with-libcurl 使用curl包 #make && make install
For Zabbix proxy database only schema.sql should be imported (no images.sql nor data.sql)
4、網絡拓撲圖介紹
5、相關配置
zabbix_server:
# egrep -v "(^$|^#)" ../etc/zabbix_server.conf LogFile=/tmp/zabbix_server.log DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=redhat DBSocket=/data/mysql/mysql.sock DBPort=3306
# egrep -v "(^$|^#)" ../etc/zabbix_agentd.conf LogFile=/tmp/zabbix_agentd.log EnableRemoteCommands=1 Server=127.0.0.1 Hostname=Zabbix server Timeout=30 Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/ UnsafeUserParameters=1
zabbix_node1:
# egrep -v '(^$|^#)' etc/zabbix_agentd.conf LogFile=/tmp/zabbix_agentd.log Server=192.168.100.252 ServerActive=127.0.0.1 Hostname=Zabbix server Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/
zabbix_proxy:採用主動模式
# egrep -v "(^$|^#)" ../etc/zabbix_proxy.conf ProxyMode=0 #指定proxy爲主動模式 Server=202.208.23.22 #這裏須要指定zabbix server所在ip ServerPort=10051 #這裏須要指定zabbix server監聽的端口 Hostname=sgwar_proxy #指定proxy的名字 ListenPort=8010 #指定proxy監聽的端口 LogFile=/tmp/zabbix_proxy.log DBHost=10.8.11.146 #proxy本地數據庫ip DBName=zabbix DBUser=zabbix DBPassword=redhat HeartbeatFrequency=30 Timeout=30 #這裏設置的超時不該爲默認的3s,默認值會使proxy與agent通訊超時 Include=/usr/local/zabbix/etc/zabbix_proxy.conf.d/
# egrep -v "(^$|^#)" ../etc/zabbix_agentd.conf LogFile=/tmp/zabbix_agentd.log Server=10.8.5.119 #指定zabbix proxy所在ip ListenPort=10050 StartAgents=3 Hostname=sgwar_web Timeout=30 Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/
zabbix_node2:採用被動模式
# egrep -v "(^$|^#)" ../etc/zabbix_agentd.conf LogFile=/tmp/zabbix_agentd.log Server=10.8.5.119 #指定zabbix proxy所在ip ListenPort=10050 StartAgents=3 Hostname=sgwar_db Timeout=30 Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/
web端相關配置:
proxy配置:【注意:這裏配置的proxy name須要和zabbix_proxy.conf配置的Hostname一致;Proxy mode須要和zabbix_proxy.conf中ProxyMode一致】
node配置:【注意:這裏配置的Host name須要和前面zabbix_agentd.conf中配置的Hostname一致;IP address須要和proxy訪問node時指定的ip一致;Monitored by proxy須要指定proxy的名字】
6、前臺監控結果
7、總結
1. zabbix這套分佈式的架構不是太難理解,可是官網對配置的介紹實在是太少,以致於配置proxy的時候感受每一個參數的配置都沒法找到根源,再加上某牆把好的資源都攔在外面,想學好技術的同窗還得再費點心思去爬牆。
2. 分析官網對proxy的解釋,不難理解proxy小局域網中的做用至關明顯,極大得減小了zabbix server的負擔,可是若是zabbix proxy沒法telnet通zabbix server的端口時,而zabbix server能夠telnet通zabbix proxy的端口,請問這種單向連通的狀況下,如何部署zabbix分佈式監控?
3. 認真體會主動模式和被動模式的區別,如何避開安全風險,同時達到必要的監控效果,而且對服務器的負載不形成太大的影響。
4. 大過年的,今天是最後一天上班,吃完中飯就下班了,祝你們回家路上平平安安,開開心心過大年 ^_^