Class: Nagios::Promoo::Appdb::Probes::SizesProbe

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

Overview

Probe for checking flavors/sizes 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



21
22
23
# File 'lib/nagios/promoo/appdb/probes/sizes_probe.rb', line 21

def declaration
  'sizes'
end

.descriptionObject



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

def description
  ['sizes', 'Run a probe checking size/flavor/resource templates in AppDB']
end

.optionsObject



17
18
19
# File 'lib/nagios/promoo/appdb/probes/sizes_probe.rb', line 17

def options
  []
end

.runnable?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/nagios/promoo/appdb/probes/sizes_probe.rb', line 25

def runnable?
  true
end

Instance Method Details

#run(_args = []) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/nagios/promoo/appdb/probes/sizes_probe.rb', line 30

def run(_args = [])
  count = Timeout.timeout(options[:timeout]) { sizes_by_endpoint.count }
  if count < 1
    puts 'SIZES CRITICAL - No size/flavor/resource templates found in AppDB'
    exit 2
  end

  puts "SIZES OK - Found #{count} size/flavor/resource templates in AppDB"
rescue => ex
  puts "SIZES UNKNOWN - #{ex.message}"
  puts ex.backtrace if options[:debug]
  exit 3
end