Class: Nagios::Promoo::Opennebula::Probes::HostErrorProbe
- Inherits:
-
BaseProbe
- Object
- BaseProbe
- Nagios::Promoo::Opennebula::Probes::HostErrorProbe
show all
- Defined in:
- lib/nagios/promoo/opennebula/probes/host_error_probe.rb
Overview
Probe for checking ONe for ERRORs on hosts.
Constant Summary
collapse
- ERROR_KEYWORD =
'ERROR'.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/host_error_probe.rb', line 21
def declaration
'host_error'
end
|
.description ⇒ Object
13
14
15
|
# File 'lib/nagios/promoo/opennebula/probes/host_error_probe.rb', line 13
def description
['host-error', 'Run a probe checking for ERRORs on hosts']
end
|
.options ⇒ Object
17
18
19
|
# File 'lib/nagios/promoo/opennebula/probes/host_error_probe.rb', line 17
def options
[]
end
|
.runnable? ⇒ Boolean
25
26
27
|
# File 'lib/nagios/promoo/opennebula/probes/host_error_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/host_error_probe.rb', line 32
def run(_args = [])
Timeout.timeout(options[:timeout]) do
errors = host_pool.select { |host| errored?(host) }
errors.map! { |host| host['NAME'] }
raise "HOSTs #{errors.inspect} are in state #{ERROR_KEYWORD}" if errors.count > 0
end
puts 'HOSTERR OK - Everything is hunky-dory'
rescue => ex
puts "HOSTERR CRITICAL - #{ex.message}"
puts ex.backtrace if options[:debug]
exit 2
end
|