Method: OpenNebula.process_monitoring
- Defined in:
- lib/opennebula/pool_element.rb
.process_monitoring(xmldoc, oid, xpath_expressions) ⇒ Hash<String, Array<Array<int>>, OpenNebula::Error] Hash with the requested xpath expressions, and an Array of [timestamp, value].
Processes the monitoring data in XML returned by OpenNebula
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/opennebula/pool_element.rb', line 266 def self.process_monitoring(xmldoc, oid, xpath_expressions) hash = {} = xmldoc.retrieve_elements( "/MONITORING_DATA/MONITORING[ID=#{oid}]/TIMESTAMP") xpath_expressions.each { |xpath| xpath_values = xmldoc.retrieve_elements( "/MONITORING_DATA/MONITORING[ID=#{oid}]/#{xpath}") if ( xpath_values.nil? ) hash[xpath] = [] else hash[xpath] = .zip(xpath_values) end } return hash end |