Skip to content

Commit

Permalink
1.fix #1 @xiaobao623
Browse files Browse the repository at this point in the history
2.add a graph of packet received and send.
3.modified the return code to adapt normal zabbix return code.
  • Loading branch information
朱金贺 committed Jul 7, 2015
1 parent 33dd0bd commit f87398a
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 15 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
##Description:
The ZooKeeper service can be monitored in one of two primary ways;

1) the command port through the use of 4 letter words

2) JMX. See the appropriate section for your environment/requirements.

1. zookeeper命令行模式结合telnet或者nc:http://zookeeper.apache.org/doc/r3.4.6/zookeeperAdmin.html#sc_zkCommands

2. 通过JMX监控zookeeper:http://zookeeper.apache.org/doc/r3.4.6/zookeeperJMX.html

##模板使用方法:
Monitoring zookeeper remotely on zabbix server.

1.upload getZookeeperInfo.py to externalscripts folder. A chmod/chown to get execution permission is necessary.

2.import the template and linked to the host.

##Macros

You don't need to modify the template if you are using the standard port to access to the zookeeper (port 2181).
If you need a different zookeeper port for the monitor, you will need to modify the {$ZOOKEEPERPORT} macro.

##Triggers

There are 2 trigger to detect zookeeper port issues.

##Graphs

There is a graph of zookeeper received packets and sended packets.


##Contributors:

* [xiaobao623 ] (https://github.com/xiaobao623)
4 changes: 0 additions & 4 deletions README.txt

This file was deleted.

4 changes: 2 additions & 2 deletions getZookeeperInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ def _parse_value(self):
elif self._zkCommand == 'ruok':

if self._value_raw == 'imok':
self._value['state'] = 0
self._value['state'] = 1
# print " server is running in a non-error state."
else:
self._value['state'] = 1
self._value['state'] = 0
# print "ruok command does not respond at all"
else:
"zkCommand is wrong"
Expand Down
60 changes: 51 additions & 9 deletions zbx_zookeeper_templates.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>2.0</version>
<date>2015-02-10T07:12:44Z</date>
<date>2015-07-07T01:51:15Z</date>
<groups>
<group>
<name>Templates</name>
Expand Down Expand Up @@ -813,21 +813,17 @@
</templates>
<triggers>
<trigger>
<<<<<<< HEAD
<expression>{Template ZooKeeper Info:getZookeeperInfo.py[&quot;-h&quot;,&quot;{HOST.CONN}&quot;,&quot;-p&quot;,&quot;{$ZOOKEEPERPORT}&quot;,&quot;-c&quot;,&quot;ruok&quot;,&quot;-k&quot;,&quot;state&quot;].last()}&lt;&gt;0</expression>
=======
<expression>{Template ZooKeeper Info:getZookeeperInfo.py[&quot;-h&quot;,&quot;{HOST.CONN}&quot;,&quot;-p&quot;,&quot;{$ZOOKEEPERPORT}&quot;,&quot;-c&quot;,&quot;ruok&quot;,&quot;-k&quot;,&quot;state&quot;].last()}&lt;&gt;1</expression>
>>>>>>> 5a01350508f1631166692fcfd3f5781b179a5c35
<name>Zookeeper does not respond</name>
<expression>{Template ZooKeeper Info:getZookeeperInfo.py[&quot;-h&quot;,&quot;{HOST.CONN}&quot;,&quot;-p&quot;,&quot;{$ZOOKEEPERPORT}&quot;,&quot;-c&quot;,&quot;ruok&quot;,&quot;-k&quot;,&quot;state&quot;].last(#3)}=0</expression>
<name>The Zookeeper is not responding in last 3 times.</name>
<url/>
<status>0</status>
<status>1</status>
<priority>4</priority>
<description/>
<type>0</type>
<dependencies/>
</trigger>
<trigger>
<expression>{Template ZooKeeper Info:net.tcp.service[tcp,,{$ZOOKEEPERPORT}].count(#3,0,&quot;eq&quot;)}=3</expression>
<expression>{Template ZooKeeper Info:net.tcp.service[tcp,,{$ZOOKEEPERPORT}].count(#2,0,&quot;eq&quot;)}=2</expression>
<name>ZooKeeperport {$ZOOKEEPERPORT} is not running</name>
<url/>
<status>0</status>
Expand All @@ -837,4 +833,50 @@
<dependencies/>
</trigger>
</triggers>
<graphs>
<graph>
<name>ZooKeeper Packets</name>
<width>900</width>
<height>200</height>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_work_period>1</show_work_period>
<show_triggers>1</show_triggers>
<type>0</type>
<show_legend>1</show_legend>
<show_3d>0</show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<ymin_type_1>0</ymin_type_1>
<ymax_type_1>0</ymax_type_1>
<ymin_item_1>0</ymin_item_1>
<ymax_item_1>0</ymax_item_1>
<graph_items>
<graph_item>
<sortorder>0</sortorder>
<drawtype>1</drawtype>
<color>99FF99</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template ZooKeeper Info</host>
<key>getZookeeperInfo.py[&quot;-h&quot;,&quot;{HOST.CONN}&quot;,&quot;-p&quot;,&quot;{$ZOOKEEPERPORT}&quot;,&quot;-c&quot;,&quot;mntr&quot;,&quot;-k&quot;,&quot;zk_packets_received&quot;]</key>
</item>
</graph_item>
<graph_item>
<sortorder>1</sortorder>
<drawtype>2</drawtype>
<color>C80000</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template ZooKeeper Info</host>
<key>getZookeeperInfo.py[&quot;-h&quot;,&quot;{HOST.CONN}&quot;,&quot;-p&quot;,&quot;{$ZOOKEEPERPORT}&quot;,&quot;-c&quot;,&quot;mntr&quot;,&quot;-k&quot;,&quot;zk_packets_sent&quot;]</key>
</item>
</graph_item>
</graph_items>
</graph>
</graphs>
</zabbix_export>

0 comments on commit f87398a

Please sign in to comment.