Class: XymonClient::ServiceItemString
- Inherits:
-
ServiceItem
- Object
- ServiceItem
- XymonClient::ServiceItemString
- Defined in:
- lib/xymonclient/serviceitem.rb
Instance Attribute Summary
Attributes inherited from ServiceItem
Instance Method Summary collapse
-
#initialize(config) ⇒ ServiceItemString
constructor
A new instance of ServiceItemString.
- #status ⇒ Object
Constructor Details
#initialize(config) ⇒ ServiceItemString
Returns a new instance of ServiceItemString.
95 96 97 98 |
# File 'lib/xymonclient/serviceitem.rb', line 95 def initialize(config) super(config) @info['threshold'] = config.fetch('threshold', {}) end |
Instance Method Details
#status ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/xymonclient/serviceitem.rb', line 100 def status @info['status'] = \ if !@info['enabled'] 'clear' elsif Time.now - @info['time'] > \ XymonClient.timestring_to_time(@info['lifetime']) 'purple' elsif @info['threshold'].key?('critical') && \ _threshold_reached?('critical') 'red' elsif @info['threshold'].key?('warning') && \ _threshold_reached?('warning') 'yellow' else 'green' end end |