Class: NagiosOutput
- Inherits:
-
Object
- Object
- NagiosOutput
- Defined in:
- lib/nagios_output.rb,
lib/nagios_output/version.rb
Overview
——————————————————————————– # Description # ——————————————————————————– # Display elapsed time in a more human readable way. # ——————————————————————————– #
Constant Summary collapse
- VERSION =
'1.0.0'.freeze
Instance Method Summary collapse
- #critical(message = nil) ⇒ Object
-
#initialize(config = { 'colour' => true }) ⇒ NagiosOutput
constructor
A new instance of NagiosOutput.
- #ok(message = nil) ⇒ Object
- #unknown(message = nil) ⇒ Object
- #warning(message = nil) ⇒ Object
Constructor Details
#initialize(config = { 'colour' => true }) ⇒ NagiosOutput
Returns a new instance of NagiosOutput.
63 64 65 |
# File 'lib/nagios_output.rb', line 63 def initialize(config = { 'colour' => true }) @colour = config['colour'] end |
Instance Method Details
#critical(message = nil) ⇒ Object
89 90 91 92 93 94 95 96 97 98 |
# File 'lib/nagios_output.rb', line 89 def critical( = nil) exit 2 if .nil? || .empty? if @colour puts "CRITICAL - #{}".red else puts "CRITICAL - #{}" end exit 2 end |
#ok(message = nil) ⇒ Object
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/nagios_output.rb', line 67 def ok( = nil) exit 0 if .nil? || .empty? if @colour puts "OK - #{}".green else puts "OK - #{}" end exit 0 end |
#unknown(message = nil) ⇒ Object
100 101 102 103 104 105 106 107 108 109 |
# File 'lib/nagios_output.rb', line 100 def unknown( = nil) exit 3 if .nil? || .empty? if @colour puts "UNKNOWN - #{}".blue else puts "UNKNOWN - #{}" end exit 3 end |
#warning(message = nil) ⇒ Object
78 79 80 81 82 83 84 85 86 87 |
# File 'lib/nagios_output.rb', line 78 def warning( = nil) exit 1 if .nil? || .empty? if @colour puts "WARNING - #{}".yellow else puts "WARNING - #{}" end exit 1 end |