lib/riemann/babbler/plugins/runit.rb in riemann-babbler-1.2.1 vs lib/riemann/babbler/plugins/runit.rb in riemann-babbler-1.2.2
- old
+ new
@@ -1,11 +1,11 @@
class Riemann::Babbler::Runit < Riemann::Babbler
def init
plugin.set_default(:service, 'runit')
plugin.set_default(:not_monit, ['riemann-client'])
- plugin.set_default(:warning_uptime, 10)
+ plugin.set_default(:uptime, 10)
plugin.set_default(:interval, 60)
end
def run_plugin
Dir.exists? '/etc/service'
@@ -24,13 +24,11 @@
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
srv_uptime = uptime(srv)
- if (File.read( stat_file ).strip == 'run') && (srv_uptime > plugin.interval)
+ if (File.read( stat_file ).strip == 'run') && (srv_uptime > plugin.uptime)
status << {:service => plugin.service + human_srv , :state => 'ok', :description => "runit service #{human_srv} running", :metric => srv_uptime}
- elsif (File.read( stat_file ).strip == 'run') && (srv_uptime < plugin.warning_uptime)
- status << {:service => plugin.service + human_srv , :state => 'warning', :description => "runit service #{human_srv} small uptime", :metric => srv_uptime}
else
status << {:service => plugin.service + human_srv , :state => 'critical', :description => "runit service #{human_srv} not running", :metric => srv_uptime}
end
end
status