Sha256: 7171fcddb92dd1ae9cf179c2144f152e4ab36bb5b54045efcd0fa5664bd47d33

Contents?: true

Size: 605 Bytes

Versions: 1

Compression:

Stored size: 605 Bytes

Contents

require 'json'

class Riemann::Babbler::Je < Riemann::Babbler

  def init
    plugin.set_default(:service, 'je')
    plugin.set_default(:interval, 60)
    plugin.set_default(:url, 'http://localhost/status')
    plugin.states.set_default(:critical, 10)
  end

  def collect
    array = Array.new
    JSON.parse( rest_get( plugin.url ) ).each do |channel|
      timing = (unixnow - channel['moment'].to_i).abs
      sid = channel['sid']
      array << { :service => plugin.service + " status #{sid}", :metric => timing.to_i, :description => "Je timming sid #{sid}, in sec." }
    end
    array
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
riemann-babbler-1.0.7.2 lib/riemann/babbler/plugins/je.rb