Sha256: ef77d461aba7014817e300ed51fc5f57af001d5b2baeddcb55604e4e45dcc9bf

Contents?: true

Size: 614 Bytes

Versions: 10

Compression:

Stored size: 614 Bytes

Contents

require 'json'

class Riemann::Babbler::Selfupdate < Riemann::Babbler

  def init
    plugin.set_default(:service, 'self update')
    plugin.set_default(:file, '/var/run/status')
  end

  def collect
    json = JSON.parse File.read(plugin.url)
    if json["status"] == "ok"
      {:service => plugin.service, :description => "Self update status in #{plugin.file}, state: OK", :metric => 1, :state => 'ok' }
    else
      {:service => plugin.service, :description => "Self update status in #{plugin.file}, state: #{state['status']}, code: #{state['code']}", :metric => 0, :state => 'critical' }
    end
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
riemann-babbler-1.0.5.5 lib/riemann/babbler/plugins/selfupdate.rb
riemann-babbler-1.0.5.4 lib/riemann/babbler/plugins/selfupdate.rb
riemann-babbler-1.0.5.3 lib/riemann/babbler/plugins/selfupdate.rb
riemann-babbler-1.0.5.2 lib/riemann/babbler/plugins/selfupdate.rb
riemann-babbler-1.0.5.1 lib/riemann/babbler/plugins/selfupdate.rb
riemann-babbler-1.0.5 lib/riemann/babbler/plugins/selfupdate.rb
riemann-babbler-1.0.4 lib/riemann/babbler/plugins/selfupdate.rb
riemann-babbler-1.0.3 lib/riemann/babbler/plugins/selfupdate.rb
riemann-babbler-1.0.2 lib/riemann/babbler/plugins/selfupdate.rb
riemann-babbler-1.0.1 lib/riemann/babbler/plugins/selfupdate.rb