Class: One2Influx::Host
- Defined in:
- lib/one2influx/one_object/host.rb
Overview
Representation of ONE host
Instance Attribute Summary collapse
-
#datastores ⇒ Object
readonly
Returns the value of attribute datastores.
Attributes inherited from OneObject
Instance Method Summary collapse
-
#initialize(xml, client) ⇒ Host
constructor
A new instance of Host.
-
#vms ⇒ array
IDs of VMs.
Methods inherited from OneObject
#method_missing, #serialize_as_points
Constructor Details
#initialize(xml, client) ⇒ Host
Returns a new instance of Host.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/one2influx/one_object/host.rb', line 9 def initialize(xml, client) # Load configuration @tag_names = $CFG.storage[:host][:tags] @metric_names = $CFG.storage[:host][:metrics] @custom_metric_names = $CFG.storage[:host][:cust_metrics] @doc = Nokogiri::XML(xml) @tags = Hash.new load_datastores if @tag_names.has_key? :DSS_IDS @tag_names.delete :DSS_IDS unless @datastores.empty? @tags[:DSS_IDS] = ',,' + @datastores.join(',,') + ',,' end end super(xml, client) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class One2Influx::OneObject
Instance Attribute Details
#datastores ⇒ Object (readonly)
Returns the value of attribute datastores.
4 5 6 |
# File 'lib/one2influx/one_object/host.rb', line 4 def datastores @datastores end |
Instance Method Details
#vms ⇒ array
Returns IDs of VMs.
31 32 33 34 35 |
# File 'lib/one2influx/one_object/host.rb', line 31 def vms @doc.xpath('//VMS/ID').map do |node| node.content end end |