Sha256: 88abc85606e08eab98f41a5b4b09edf457a55069f1dd88e8a94f62f931986c72
Contents?: true
Size: 917 Bytes
Versions: 16
Compression:
Stored size: 917 Bytes
Contents
#!/usr/bin/env ruby # 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
16 entries across 16 versions & 2 rubygems