class XymonClient::ServiceItem
Manage an item to monitor
Attributes
attributes[RW]
description[RW]
enabled[RW]
label[RW]
lifetime[RW]
status[R]
time[R]
value[RW]
Public Class Methods
new(config)
click to toggle source
# File lib/xymonclient/serviceitem.rb, line 17 def initialize(config) raise InvalidServiceItemName if config.fetch('label', '') == '' @time = Time.at(0) @threshold = config.fetch('threshold', {}) @attributes = config.fetch('attributes', {}) update_config(config) end
Public Instance Methods
context()
click to toggle source
# File lib/xymonclient/serviceitem.rb, line 55 def context { 'label' => @label, 'description' => @description, 'enabled' => @enabled, 'lifetime' => @lifetime, 'timestamp' => @timestamp, 'threshold' => @threshold, 'attributes' => @attributes, 'status' => @status, 'value' => @value } end
update_config(config)
click to toggle source
# File lib/xymonclient/serviceitem.rb, line 45 def update_config(config) raise InvalidServiceItemName if config.fetch('label', '') == '' @label = config['label'] @description = config.fetch('description', '') @enabled = config.fetch('enabled', true) @lifetime = config.fetch('lifetime', '30m') @threshold = config.fetch('threshold', {}) @attributes.merge!(config.fetch('attributes', {})) end
value=(value)
click to toggle source
# File lib/xymonclient/serviceitem.rb, line 25 def value=(value) @value = value @time = Time.now status end