Class: XymonClient::ServiceItemGauge
- Inherits:
-
ServiceItem
- Object
- ServiceItem
- XymonClient::ServiceItemGauge
- Defined in:
- lib/xymonclient/serviceitem.rb
Instance Attribute Summary
Attributes inherited from ServiceItem
Instance Method Summary collapse
-
#initialize(config) ⇒ ServiceItemGauge
constructor
A new instance of ServiceItemGauge.
- #status ⇒ Object
Constructor Details
#initialize(config) ⇒ ServiceItemGauge
Returns a new instance of ServiceItemGauge.
51 52 53 54 55 |
# File 'lib/xymonclient/serviceitem.rb', line 51 def initialize(config) super(config) @info['threshold'] = config.fetch('threshold', {}) @info['nan_status'] = config.fetch('nan_status', 'green') end |
Instance Method Details
#status ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/xymonclient/serviceitem.rb', line 57 def status @info['status'] = \ if !@info['enabled'] 'clear' elsif Time.now - @info['time'] > \ XymonClient.timestring_to_time(@info['lifetime']) 'purple' elsif value.instance_of?(Float) && value.nan? @info['threshold'].fetch('nan_status', 'red') elsif @info['threshold'].key?('critical') && \ _threshold_reached?('critical') 'red' elsif @info['threshold'].key?('warning') && \ _threshold_reached?('warning') 'yellow' else 'green' end end |