设为首页 收藏本站
查看: 1309|回复: 0

[经验分享] zabbix proxy配置

[复制链接]

尚未签到

发表于 2015-9-9 08:39:09 | 显示全部楼层 |阅读模式
  一、zabbix官网对proxy的介绍
  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.
  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.
  A Zabbix proxy can be used to:




  • Monitor remote locations


  • Monitor locations having unreliable communications


  • Offload the Zabbix server when monitoring thousands of devices


  • Simplify the maintenance of distributed monitoring
  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.
DSC0000.png
  二、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.
  The benefits of using a node setup:




  • building a multi-level hierarchy of monitoring in a large network involving several geographical locations. A node in the hierarchy reports to its master node only.




  • a node can be configured locally or through its master node, which has a copy of configuration data of all child nodes.




  • data gathering becomes more immune to possible communication problems. If communication between a master and a child node breaks down, nodes can keep operating. Historical information and events are stored locally. When communication is back, a child node will optionally send the data to the master node.




  • the nodes can split the work of a single Zabbix server having to monitor thousands of hosts




  • attaching and detaching new nodes does not affect the functionality of the existing setup. No restart of any node required.
  三、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)
  四、网络拓扑图介绍
DSC0001.png
  五、相关配置
  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一致】
DSC0002.png
  node配置:【注意:这里配置的Host name需要和前面zabbix_agentd.conf中配置的Hostname一致;IP address需要和proxy访问node时指定的ip一致;Monitored by proxy需要指定proxy的名字】
DSC0003.png
  六、前台监控结果
DSC0004.png
  七、总结
  1. zabbix这套分布式的架构不是太难理解,但是官网对配置的介绍实在是太少,以至于配置proxy的时候感觉每个参数的配置都无法找到根源,再加上某墙把好的资源都拦在外面,想学好技术的同学还得再费点心思去爬墙。
  2. 分析官网对proxy的解释,不难理解proxy小局域网中的作用相当明显,极大得减少了zabbix server的负担,但是如果zabbix proxy无法telnet通zabbix server的端口时,而zabbix server可以telnet通zabbix proxy的端口,请问这种单向连通的情况下,如何部署zabbix分布式监控?
  3. 认真体会主动模式和被动模式的区别,如何避开安全风险,同时达到必要的监控效果,并且对服务器的负载不造成太大的影响。
  4. 大过年的,今天是最后一天上班,吃完中饭就下班了,祝大家回家路上平平安安,开开心心过大年 ^_^
  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-111212-1-1.html 上篇帖子: zabbix------简单配置监控centos 下篇帖子: [zabbix]zabbix分区表操作步骤
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表