Class: Nagios::Promoo::Opennebula::Probes::VirtualMachineFailsProbe
- Inherits:
-
BaseProbe
- Object
- BaseProbe
- Nagios::Promoo::Opennebula::Probes::VirtualMachineFailsProbe
show all
- Defined in:
- lib/nagios/promoo/opennebula/probes/virtual_machine_fails_probe.rb
Overview
Probe for checking ONe for FAILED virtual machines.
Constant Summary
collapse
- FAIL_KEYWORD =
'FAILURE'.freeze
Instance Attribute Summary
Attributes inherited from BaseProbe
#options
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from BaseProbe
#client, #initialize
Class Method Details
.declaration ⇒ Object
21
22
23
|
# File 'lib/nagios/promoo/opennebula/probes/virtual_machine_fails_probe.rb', line 21
def declaration
'virtual_machine_fails'
end
|
.description ⇒ Object
13
14
15
|
# File 'lib/nagios/promoo/opennebula/probes/virtual_machine_fails_probe.rb', line 13
def description
['virtual-machine-fails', 'Run a probe checking for FAILED virtual machines']
end
|
.options ⇒ Object
17
18
19
|
# File 'lib/nagios/promoo/opennebula/probes/virtual_machine_fails_probe.rb', line 17
def options
[]
end
|
.runnable? ⇒ Boolean
25
26
27
|
# File 'lib/nagios/promoo/opennebula/probes/virtual_machine_fails_probe.rb', line 25
def runnable?
true
end
|
Instance Method Details
#run(_args = []) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/nagios/promoo/opennebula/probes/virtual_machine_fails_probe.rb', line 32
def run(_args = [])
Timeout.timeout(options[:timeout]) do
fails = virtual_machine_pool.select { |vm| failed?(vm) }
fails.map!(&:id)
raise "Virtual machines #{fails.inspect} are in a FAILED state" if fails.count > 0
end
puts 'VMFAILS OK - Everything is hunky-dory'
rescue => ex
puts "VMFAILS CRITICAL - #{ex.message}"
puts ex.backtrace if options[:debug]
exit 2
end
|