Class: Nagios::Check::Threshold
- Inherits:
-
Object
- Object
- Nagios::Check::Threshold
- Defined in:
- lib/nagios-check/threshold.rb
Instance Method Summary collapse
- #crit(value = nil) ⇒ Object
- #get_status(value) ⇒ Object
-
#initialize(thresholds = {}) ⇒ Threshold
constructor
A new instance of Threshold.
- #warn(value = nil) ⇒ Object
Constructor Details
#initialize(thresholds = {}) ⇒ Threshold
Returns a new instance of Threshold.
5 6 7 8 |
# File 'lib/nagios-check/threshold.rb', line 5 def initialize(thresholds = {}) set(:warn, thresholds[:warn]) set(:crit, thresholds[:crit]) end |
Instance Method Details
#crit(value = nil) ⇒ Object
15 16 17 18 |
# File 'lib/nagios-check/threshold.rb', line 15 def crit(value = nil) set(:crit, value) if value @crit end |
#get_status(value) ⇒ Object
20 21 22 23 24 |
# File 'lib/nagios-check/threshold.rb', line 20 def get_status(value) return Nagios::CRITICAL if self.crit && self.crit.check_range(value) return Nagios::WARNING if self.warn && self.warn.check_range(value) return Nagios::OK end |
#warn(value = nil) ⇒ Object
10 11 12 13 |
# File 'lib/nagios-check/threshold.rb', line 10 def warn(value = nil) set(:warn, value) if value @warn end |