Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Plain View
Zookeeper >> mail # user >> Announcing availability of Net::ZKMon perl wrapper module for ZooKeeper monitoring


Copy link to this message
-
Announcing availability of Net::ZKMon perl wrapper module for ZooKeeper monitoring
Hi,

I have put together a perl module named 'Net::ZKMon',  a wrapper
module around the ZooKeeper's 4-letter word commands meant for
zookeeper monitoring.

This module is written and meant to the serve the purpose of
  -  providing a perl interface to executing 4-letter command as just
another perl function,
  -  having the monitoring data in a structured perl references
  - and attempting to reduce the pains/overhead/hassle involved in
parsing the entire monitoring data when the 4-letter words are
executed.

This is a very initial bare-bones release seeding the thought of
wrapping around the monitoring with perl's style of doing things. Its
in a very nascent stages with incomplete set of documentation as of
yet, however I hope to see it being used as a plugin module required
for other sorts of monitoring systems like
collectd/nagios/ganglia/cacti (for both alerting & graphing) for
monitoring Zookeeper, with full documentation soon. The package will
also get to have more examples for easier integration with general
monitoring systems.

About Apache ZooKeeper 4-letter words/commands :
http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_zkCommands

Source of the code is available and published at
http://search.cpan.org/~mnikhil/Net-ZKMon/

I am also open for the ideas/suggestions/ improvements/collaboration.
Please feel free to fork the code yourself at github here :
https://github.com/mnikhil-git/p5-Net-ZKMon

An Example:
==========#!/usr/bin/perl
use strict;
use Net::ZKMon;

my $hosta = 'host1.prod.mycompany.com';
my $hostb = 'host2.prod.mycompany.com';
my $hostc = 'host3.prod.mycompany.com';
my $hostd = 'host4.prod.mycompany.com';
my $hoste = 'host5.prod.mycompany.com';

my @zcluster = ( $hosta , $hostb , $hostc, $hostd, $hoste );

my $zkmon = new Net::ZKMon(hostname => $hosta);

print $hosta, ": version : ", $zkmon->stat->{'version'}, "\n\n";
foreach my $h (@zcluster) {
   my $h_srvr = $zkmon->stat($h);
   print "Node: $h  --> $h_srvr->{version} | $h_srvr->{Mode} |
$h_srvr->{Zxid}  | $h_srvr->{'Node count'} ",
          " | $h_srvr->{min_latency} | $h_srvr->{max_latency} |
$h_srvr->{avg_latency} \n";
}

Output:

host1.prod.mycompany.com  version : 3.3.4

Node: host1.prod.mycompany.com  --> 3.3.4 | follower | 0x50003ad60  |
18  | 0 | 753 | 0
Node: host2.prod.mycompany.com  --> 3.3.4 | follower | 0x50003ad60  |
18  | 0 | 53 | 0
Node: host3.prod.mycompany.com  --> 3.3.4 | follower | 0x50003ad60  |
18  | 0 | 9 | 1
Node: host4.prod.mycompany.com  --> 3.3.4 | follower | 0x50003ad60  |
18  | 0 | 752 | 0
Node: host5.prod.mycompany.com  --> 3.3.4 | leader   | 0x50003ad60  |
18  | 0 | 252 | 0

Thanks,
Nikhil
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB