Class: Nagios::Promoo::Appdb::Probes::AppliancesProbe

Inherits:
BaseProbe
  • Object
show all
Defined in:
lib/nagios/promoo/appdb/probes/appliances_probe.rb

Overview

Probe for checking appliance availability in AppDB.

Author:

Constant Summary

Constants inherited from BaseProbe

BaseProbe::APPDB_IS_URL, BaseProbe::DEFAULT_HEADERS, BaseProbe::GQL_APPLIANCES_BY_ENDPOINT, BaseProbe::GQL_SIZES_BY_ENDPOINT

Instance Attribute Summary

Attributes inherited from BaseProbe

#endpoint, #options, #vo

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseProbe

#appliances_by_endpoint, #initialize, #sizes_by_endpoint

Constructor Details

This class inherits a constructor from Nagios::Promoo::Appdb::Probes::BaseProbe

Class Method Details

.declarationObject



30
31
32
# File 'lib/nagios/promoo/appdb/probes/appliances_probe.rb', line 30

def declaration
  'appliances'
end

.descriptionObject



13
14
15
# File 'lib/nagios/promoo/appdb/probes/appliances_probe.rb', line 13

def description
  ['appliances', 'Run a probe checking appliances in AppDB']
end

.optionsObject



17
18
19
20
21
22
23
24
25
26
27
28
# 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?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/nagios/promoo/appdb/probes/appliances_probe.rb', line 34

def runnable?
  true
end

Instance Method Details

#run(_args = []) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
# 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