Class: CheckFromFile::Check
- Inherits:
-
Nagios::Plugin
- Object
- Nagios::Plugin
- CheckFromFile::Check
- Defined in:
- lib/check_from_file/check.rb
Instance Method Summary collapse
- #check ⇒ Object
- #critical? ⇒ Boolean
-
#initialize(options) ⇒ Check
constructor
A new instance of Check.
- #message ⇒ Object
- #ok? ⇒ Boolean
- #warning? ⇒ Boolean
Constructor Details
#initialize(options) ⇒ Check
Returns a new instance of Check.
6 7 8 |
# File 'lib/check_from_file/check.rb', line 6 def initialize() @options = end |
Instance Method Details
#check ⇒ Object
25 26 27 28 29 |
# File 'lib/check_from_file/check.rb', line 25 def check @return = File.read(@options[:return]).to_i @stdout = File.read(@options[:stdout]) @stderr = File.read(@options[:stderr]) end |
#critical? ⇒ Boolean
10 11 12 13 14 15 |
# File 'lib/check_from_file/check.rb', line 10 def critical? unless @return == 0 @error = true return false end end |
#message ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/check_from_file/check.rb', line 31 def ret = "Command: #{@options[:command]} returned " if @error ret << "#{@return}, STDOUT: #{@stdout}, STDERR: #{@stderr}" else ret << "successfully" end ret end |
#ok? ⇒ Boolean
21 22 23 |
# File 'lib/check_from_file/check.rb', line 21 def ok? true end |
#warning? ⇒ Boolean
17 18 19 |
# File 'lib/check_from_file/check.rb', line 17 def warning? false # We don't support a warning state, just critical or ok end |