zookeeper-digest icon indicating copy to clipboard operation
zookeeper-digest copied to clipboard

Analyze Apache ZooKeeper traffic in realtime

h1. ZooKeeper Digest

Author: "Patrick Hunt":http://people.apache.org/~phunt/ (follow me on "twitter":http://twitter.com/phunt)

h2. Summary

This is a work in progress, use at your own risk

"This project":http://github.com/phunt/zookeeper-digest was inspired by "Maatkit's":http://www.maatkit.org/ mk-query-digest utility. This is essentially a protocol analysis tool, currently focused on analyzing real time traffic (via "scapy":http://www.secdev.org/projects/scapy/index.html), or as captured by "tcpdump":http://www.tcpdump.org/ to a file.

h3. What's Apache ZooKeeper?

From the "official site":http://hadoop.apache.org/zookeeper/: "ZooKeeper is a high-performance coordination service for distributed applications."

It exposes common services - such as naming, configuration management, synchronization, and group services - in a simple interface so you don't have to write them from scratch. You can use it off-the-shelf to implement consensus, group management, leader election, and presence protocols.

h2. Overview

Capture information from a ZooKeeper cluster and this tool will output an analysis of the interactions/operations.

h2. License

This project is licensed under the Apache License Version 2.0

h2. Requirements

  • "Scapy":http://www.secdev.org/projects/scapy/index.html#download 2.1.0 and later
  • "tcpdump":http://www.tcpdump.org/
  • Python 2.6

h2. Usage

Usage: zookeeper-digest.py [options]

Options:
  -h, --help            show this help message and exit
  --servers=SERVERS     comma separated list of host:port
  -i INTERFACE, --intf=INTERFACE
                        interface from which to read packets
  -r READ, --read=READ  pcap file from which to read packets
  --show                show full packet detail
  --summary             show summary packet detail
  --debug               show all pkts

Summary results: sudo ./zookeeper-digest.py -i --servers "localhost:2181" --summary

Detailed results: sudo ./zookeeper-digest.py -i --servers "localhost:2181" --show

Save to a file using tcpdump, decode later: sudo tcpdump -w -i -s 1600 "tcp and (port )" ./zookeeper-digest.py -r --summary

where <zk client port> is typically 2181 and <interface> typically eth0 or ath0 or wlan0, etc...