Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add metric to count connected clients to ganglia zookeeper module #9

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/contrib/monitoring/ganglia/zookeeper.pyconf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ collection_group {
metric { name = "zk_min_latency" }
metric { name = "zk_packets_received" }
metric { name = "zk_packets_sent" }
metric { name = "zk_connected_clients" }
metric { name = "zk_outstanding_requests" }
metric { name = "zk_znode_count" }
metric { name = "zk_watch_count" }
Expand Down
15 changes: 13 additions & 2 deletions src/contrib/monitoring/ganglia/zookeeper_ganglia.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,18 @@ def _parse_stat(self, data):
if version:
result['zk_version'] = version[version.index(':')+1:].strip()

# skip all lines until we find the empty one
while h.readline().strip(): pass
# count the number of connected clients till you get to a blank line
line = h.readline().strip()
num_clients=0
while line: # this will break on the first empty line
# lines that look like this are connected clients:
# /10.0.0.128:38471[1](queued=0,recved=302,sent=302)
m = re.match('/[0-9.]+:\d+.*', line)
if m is not None:
num_clients += 1
# get the next line and repeat
line = h.readline().strip()
result['zk_connected_clients'] = num_clients

for line in h.readlines():
m = re.match('Latency min/avg/max: (\d+)/(\d+)/(\d+)', line)
Expand Down Expand Up @@ -169,6 +179,7 @@ def metric_init(params=None):
'units': 'packets',
'slope': 'positive'
},
'zk_connected_clients': {'units': 'connections'},
'zk_outstanding_requests': {'units': 'connections'},
'zk_znode_count': {'units': 'znodes'},
'zk_watch_count': {'units': 'watches'},
Expand Down