wasim37 / zabbix-es Goto Github PK
View Code? Open in Web Editor NEWzabbix监控Elasticsearch集群
Home Page: http://www.wangxin123.com
zabbix监控Elasticsearch集群
Home Page: http://www.wangxin123.com
您好.创建键值对映射的图片失效了,可以麻烦修正一下吗
你好,我使用这个python监控脚本的时候,无论节点是否运行,ESzabbix[service,status]这个监控项的返回值始终为1。
在您的监控脚本的79~85行是这样写的:
79 elif sys.argv[1] == 'service':
80 if sys.argv[2] == 'status':
81 try:
82 conn.ping()
83 returnval = 1
84 except Exception, e:
85 returnval = 0
我在/usr/lib/python2.6/site-packages/elasticsearch/client/init.py里面看到ping方法是这样定义的:
根据注释,返回True即为服务up,返回False即为服务down,
那么现在假设节点挂掉,conn.ping()会返回False,但是并不会捕捉异常,try里面的内容仍会执行,returnval仍然等于1,换句话说,不管节点挂没挂掉,returnval始终等于1,这样肯定不对吧?
另外,我经过查找,找到ping()会调用/usr/lib/python2.6/site-packages/elasticsearch/transport.py里面的Transport类的perform_request方法,它在尝试连接第4次连不上的时候会抛出异常,是在327到337执行,我这里最后打印了一下异常:
ConnectionError(<urllib3.connection.HTTPConnection object at 0xfc0ad0>: Failed to establish a new connection: [Errno 111] nection object at 0xfc0ad0>: Failed to establish a new connection: [Errno 111] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0xfc0b10>: Failed to establish a new connection: [Errno 111] nection object at 0xfc0b10>: Failed to establish a new connection: [Errno 111] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0xfc0a90>: Failed to establish a new connection: [Errno 111] nection object at 0xfc0a90>: Failed to establish a new connection: [Errno 111] Connection refused)
ConnectionError(<urllib3.connection.HTTPConnection object at 0xfc0ad0>: Failed to establish a new connection: [Errno 111] nection object at 0xfc0ad0>: Failed to establish a new connection: [Errno 111] Connection refused)
此时我的节点还处于运行状态,但是就像前面说的那样,perform_request方法最终会抛出异常,异常再在ping()方法中抛出,最后conn.ping还是返回False,returnval=1,不知道这里是什么原因。
您如果有时间的话能看下这个问题吗,感激不尽!
/etc/zabbix/zabbix_externalscripts/ESzabbix.py
/etc/zabbix/agent_include/ESzabbix.userparm
zabbix_externalscripts和zabbix_include这两个目录没有看到呢?
是不是安装版本或者安装方式上有特殊要求?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.