[GitHub] zookeeper pull request #425: Add keys for the Zxid from the stat command

2017-12-05 Thread alexbb
Github user alexbb commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/425#discussion_r155075540
  
--- Diff: src/contrib/monitoring/check_zookeeper.py ---
@@ -169,11 +169,16 @@ def __init__(self, host='localhost', port='2181', 
timeout=1):
 def get_stats(self):
 """ Get ZooKeeper server stats as a map """
 data = self._send_cmd('mntr')
+stat = self._parse_stat(self._send_cmd('stat'))
 if data:
-return self._parse(data)
+mntr = self._parse(data)
+missing = ['zk_zxid', 'zk_zxid_counter', 'zk_zxid_epoch']
--- End diff --

How about changing the below to:

```python
for s in stat:
if s not in mntr:
mntr[s] = stat[s]
```

It will have the same effect now, but if future things are added to stat 
but not mntr we'd pick them up.


---


[GitHub] zookeeper issue #425: Add keys for the Zxid from the stat command

2017-12-05 Thread alexbb
Github user alexbb commented on the issue:

https://github.com/apache/zookeeper/pull/425
  
Created Jira ZOOKEEPER-2950: 
https://issues.apache.org/jira/browse/ZOOKEEPER-2950


---


[GitHub] zookeeper pull request #425: Add keys for the Zxid from the stat command

2017-12-05 Thread alexbb
Github user alexbb commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/425#discussion_r155040839
  
--- Diff: src/contrib/monitoring/check_zookeeper.py ---
@@ -169,11 +169,16 @@ def __init__(self, host='localhost', port='2181', 
timeout=1):
 def get_stats(self):
 """ Get ZooKeeper server stats as a map """
 data = self._send_cmd('mntr')
+stat = self._parse_stat(self._send_cmd('stat'))
 if data:
-return self._parse(data)
+mntr = self._parse(data)
+missing = ['zk_zxid', 'zk_zxid_counter', 'zk_zxid_epoch']
--- End diff --

Because the rest of the stat output is already present in the mntr output. 
Previously for servers that support the mntr command the script wouldn't run 
stat at all: I only added it because the zxid info is not in mntr.


---


[GitHub] zookeeper pull request #425: Add keys for the Zxid from the stat command

2017-12-05 Thread alexbb
Github user alexbb commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/425#discussion_r155040923
  
--- Diff: src/contrib/monitoring/check_zookeeper.py ---
@@ -251,6 +256,13 @@ def _parse_stat(self, data):
 result['zk_znode_count'] = int(m.group(1))
 continue
 
+m = re.match('Zxid: (0x[0-9a-fA-F]+)', line)
+if m is not None:
+result['zk_zxid'] = int(m.group(1), 16) # convert 
from hex
--- End diff --

Sounds good, update coming up.


---


[GitHub] zookeeper pull request #425: Add keys for the Zxid from the stat command

2017-11-29 Thread alexbb
GitHub user alexbb opened a pull request:

https://github.com/apache/zookeeper/pull/425

Add keys for the Zxid from the stat command

Add keys for the zxid and its component pieces: epoch and transaction 
counter. These are not reported by the 'mntr' command so they must be obtained 
from 'stat'. The counter is useful for tracking transaction rates, and epoch is 
useful for tracking leader churn.

 zk_zxid - the 64bit zxid from ZK
 zk_zxid_counter - the lower 32 bits, AKA the counter
 zk_zxid_epoch   - the upper 32 bits, AKA the epoch

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/alexbb/zookeeper add_zxid_stats

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/zookeeper/pull/425.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #425


commit 874628db69ea59b7f3856007a9b1fb377ff86a4d
Author: Alex Bame <a...@724support.com>
Date:   2017-11-29T16:59:32Z

add keys for the Zxid from the stat command:
 zk_zxid - the 64bit zxid from ZK
 zk_zxid_counter - the lower 32 bits, AKA the counter
 zk_zxid_epoch   - the upper 32 bits, AKA the epoch




---