Sha256: 761758c75078caa9dca1768abec479da15dc34a91239ba2c1f8adb2ad80b9db7

Contents?: true

Size: 615 Bytes

Versions: 6

Compression:

Stored size: 615 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.file)
    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

6 entries across 6 versions & 1 rubygems

Version Path
riemann-babbler-1.0.7.2 lib/riemann/babbler/plugins/selfupdate.rb
riemann-babbler-1.0.7.1 lib/riemann/babbler/plugins/selfupdate.rb
riemann-babbler-1.0.7 lib/riemann/babbler/plugins/selfupdate.rb
riemann-babbler-1.0.6 lib/riemann/babbler/plugins/selfupdate.rb
riemann-babbler-1.0.5.7 lib/riemann/babbler/plugins/selfupdate.rb
riemann-babbler-1.0.5.6 lib/riemann/babbler/plugins/selfupdate.rb