Class: OpennebulaProbe
- Inherits:
-
Object
- Object
- OpennebulaProbe
- Defined in:
- lib/probe/opennebula_probe.rb
Overview
OpennebulaProbe covers generic implementation of subprobes.
Attributes
-
logger - Logger connector.
-
message - Resulting message.
-
retval - Probe status constant.
-
endpoint - Server URI.
Options
-
opts - Hash with parsed command line arguments.
Examples
Instance is initialized from child class
Direct Known Subclasses
OpenNebulaEconeProbe, OpenNebulaOcciProbe, OpenNebulaOnedProbe
Constant Summary collapse
- OK_MSG =
'Remote resources successfully queried!'- WARN_MSG =
'Failed to query specified remote resources!'- CRIT_MSG =
'Failed to establish connection with the remote server!'- UNKWN_MSG =
'An exception or error occured!'
Instance Attribute Summary collapse
-
#logger ⇒ Object
writeonly
Sets the attribute logger.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#retval ⇒ Object
readonly
Returns the value of attribute retval.
Instance Method Summary collapse
- #check_crit ⇒ Object
- #check_warn ⇒ Object
- #crit? ⇒ Boolean
-
#initialize(opts = {}) ⇒ OpennebulaProbe
constructor
A new instance of OpennebulaProbe.
- #run ⇒ Object
- #warn? ⇒ Boolean
Constructor Details
#initialize(opts = {}) ⇒ OpennebulaProbe
Returns a new instance of OpennebulaProbe.
57 58 59 60 61 62 63 |
# File 'lib/probe/opennebula_probe.rb', line 57 def initialize(opts = {}) @opts = opts @retval = UNKNOWN @logger = nil @message = "#{UNKWN_MSG}" @endpoint = "#{@opts.protocol.to_s}://#{@opts.hostname}:#{@opts.port.to_s}#{@opts.path}" end |
Instance Attribute Details
#logger=(value) ⇒ Object (writeonly)
Sets the attribute logger
55 56 57 |
# File 'lib/probe/opennebula_probe.rb', line 55 def logger=(value) @logger = value end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
54 55 56 |
# File 'lib/probe/opennebula_probe.rb', line 54 def @message end |
#retval ⇒ Object (readonly)
Returns the value of attribute retval.
54 55 56 |
# File 'lib/probe/opennebula_probe.rb', line 54 def retval @retval end |
Instance Method Details
#check_crit ⇒ Object
65 66 67 68 |
# File 'lib/probe/opennebula_probe.rb', line 65 def check_crit # overridden in child class true end |
#check_warn ⇒ Object
70 71 72 73 |
# File 'lib/probe/opennebula_probe.rb', line 70 def check_warn # overridden in child class true end |
#crit? ⇒ Boolean
75 76 77 78 79 80 |
# File 'lib/probe/opennebula_probe.rb', line 75 def crit? return false unless check_crit @retval = CRITICAL @message = "CRITICAL: #{CRIT_MSG}" true end |