Sha256: 9983c43aad8816439f0ce4b1d81bc468ed467e008fa5b612b2a1118e49dadd37

Contents?: true

Size: 599 Bytes

Versions: 3

Compression:

Stored size: 599 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
      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

3 entries across 3 versions & 1 rubygems

Version Path
riemann-babbler-1.0.7.1 lib/riemann/babbler/plugins/je.rb
riemann-babbler-1.0.7 lib/riemann/babbler/plugins/je.rb
riemann-babbler-1.0.6 lib/riemann/babbler/plugins/je.rb