class Nagios::Promoo::Appdb::Probes::AppliancesProbe

Probe for checking appliance availability in AppDB.

@author Boris Parak <parak@cesnet.cz>

Public Class Methods

declaration() click to toggle source
# File lib/nagios/promoo/appdb/probes/appliances_probe.rb, line 30
def declaration
  'appliances'
end
description() click to toggle source
# File lib/nagios/promoo/appdb/probes/appliances_probe.rb, line 13
def description
  ['appliances', 'Run a probe checking appliances in AppDB']
end
options() click to toggle source
# File lib/nagios/promoo/appdb/probes/appliances_probe.rb, line 17
def options
  [
    [
      :vo,
      {
        type: :string,
        required: true,
        desc: 'Virtual Organization name (used to select the appropriate set of appliances)'
      }
    ]
  ]
end
runnable?() click to toggle source
# File lib/nagios/promoo/appdb/probes/appliances_probe.rb, line 34
def runnable?
  true
end

Public Instance Methods

run(_args = []) click to toggle source
# File lib/nagios/promoo/appdb/probes/appliances_probe.rb, line 39
def run(_args = [])
  count = Timeout.timeout(options[:timeout]) { appliances_by_endpoint.count }
  if count < 1
    puts "APPLIANCES CRITICAL - No appliances found for VO #{vo} in AppDB"
    exit 2
  end

  puts "APPLIANCES OK - Found #{count} appliances for VO #{vo} in AppDB"
rescue => ex
  puts "APPLIANCES UNKNOWN - #{ex.message}"
  puts ex.backtrace if options[:debug]
  exit 3
end