Sha256: 75324625dd4045e3232b017b198f3db955206cb146768134c395c11410544a04
Contents?: true
Size: 1.1 KB
Versions: 8
Compression:
Stored size: 1.1 KB
Contents
class Riemann::Babbler::Runit < Riemann::Babbler def init plugin.set_default(:service, 'runit') plugin.set_default(:not_monit, []) plugin.set_default(:interval, 10) end def run_plugin Dir.exists? '/etc/service' @status_history = Array.new end def read_run_status status = Array.new Dir.glob('/etc/service/*').each do |srv| next if plugin.not_monit.include? srv human_srv = ' ' + srv.gsub(/\/etc\/service\//,"") stat_file = File.join(srv, 'supervise', 'stat') next unless File.exists? stat_file if File.read( stat_file ).strip == 'run' @status_history.delete "human_srv" status << {:service => plugin.service + human_srv , :state => 'ok', :description => "runit service #{human_srv} running"} else status << {:service => plugin.service + human_srv , :state => 'critical', :description => "runit service #{human_srv} not running"} if @status_history.include? human_srv @status_history << human_srv unless @status_history.include? human_srv end end status end def collect read_run_status end end
Version data entries
8 entries across 8 versions & 1 rubygems