Sha256: 46dd3b28349862cb286120799f7a3debebd59b2221fb6979f6abb86869eb8ca7
Contents?: true
Size: 942 Bytes
Versions: 1
Compression:
Stored size: 942 Bytes
Contents
#!/usr/bin/env ruby Process.setproctitle($0) # Gathers zookeeper STATS and submits them to Riemann. require File.expand_path('../../lib/riemann/tools', __FILE__) class Riemann::Tools::Zookeeper include Riemann::Tools require 'socket' opt :zookeeper_host, "Zookeeper hostname", :default => 'localhost' opt :zookeeper_port, "Zookeeper port", :default => 2181 def tick sock = TCPSocket.new(opts[:zookeeper_host], opts[:zookeeper_port]) sock.sync = true sock.print("mntr") sock.flush data = {} while true stats = sock.gets break if stats.nil? m = stats.match /^(\w+)\t+(.*)/ report( :host => opts[ :zookeeper_host].dup, :service => "zookeeper #{m[1]}", :metric => m[2].to_f, :state => 'ok', :tags => ['zookeeper'] ) end sock.close end end Riemann::Tools::Zookeeper.run
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
riemann-tools-1.0.0 | bin/riemann-zookeeper |