README 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. Tools and Recipes for ZooKeeper Monitoring
  2. ------------------------------------------
  3. How To Monitor
  4. --------------
  5. A ZooKeeper cluster can be monitored in two ways:
  6. 1. by using the 'mntr' 4letterword command
  7. 2. by using JMX to query the MBeans
  8. This repo contains tools and recipes for monitoring ZooKeeper using the first method.
  9. Check the file JMX-RESOURCE for some links to resources that could help you monitor a ZooKeeper cluster using the JMX interface.
  10. Requirements
  11. ------------
  12. ZooKeeper 3.4.0 or later or you can apply ZOOKEEPER-744 patch over the latest 3.3.x release.
  13. The server should understand the 'mntr' 4letterword command.
  14. $ echo 'mntr' | nc localhost 2181
  15. zk_version 3.4.0--1, built on 06/19/2010 15:07 GMT
  16. zk_avg_latency 141
  17. zk_max_latency 1788
  18. zk_min_latency 0
  19. zk_packets_received 385466
  20. zk_packets_sent 435364
  21. zk_num_alive_connections 1
  22. zk_outstanding_requests 0
  23. zk_server_state follower
  24. zk_znode_count 5
  25. zk_watch_count 0
  26. zk_ephemerals_count 0
  27. zk_approximate_data_size 41
  28. zk_open_file_descriptor_count 20
  29. zk_max_file_descriptor_count 1024
  30. Python 2.6 (maybe it works on previous version but it's not tested yet).
  31. In a nutshell
  32. -------------
  33. All you need is check_zookeeper.py It has no external dependencies.
  34. *** On Nagios call the script like this:
  35. ./check_zookeeper.py -o nagios -s "<server-or-list-of-servers>" -k <key> -w <warning> -c <critical>
  36. *** On Cacti define a custom data input method using the script like this:
  37. ./check_zookeeper.py -o cacti -s "<list-of-servers>" -k <key> --leader
  38. -- outputs a single value for the given key fetched from the cluster leader
  39. OR
  40. ./check_zookeeper.py -o cacti -s "<list-of-servers>" -k <key>
  41. -- outputs multiple values on for each cluster node
  42. ex: localhost_2182:0 localhost_2183:0 localhost_2181:0 localhost_2184:0 localhost_2185:0
  43. *** On Ganglia:
  44. install the plugin found in the ganglia/ subfolder OR
  45. ./check_zookeeper.py -o ganglia -s "<current-zookeeper-node>"
  46. it will use gmetric to send zookeeper node status data.
  47. Check the subfolders for configuration details and samples for each platform.
  48. License
  49. -------
  50. Apache License 2.0 or later.
  51. ZooKeeper 4letterwords Commands
  52. -------------------------------
  53. http://zookeeper.apache.org/docs/current/zookeeperAdmin.html#sc_zkCommands