Consumption Analytics Documentation

Home > Documentation for older versions > Cloud Cruiser 4 > Collecting, transforming, and publishing > XML


This article explains concepts that you need to understand to work with the XML Collector, which retrieves data from an Extensible Markup Language (XML) file and writes it to CC Records.

This section of articles contains the following:


The XML Collector reads an XML document hierarchically based on XPath expressions you specify, writing the output fields you specify to CC Records. It writes one CC Record for the root node and one for each node matching an XPath expression, though you can use accumulation to combine the output for these nodes into fewer records. You can also use variables to move or copy values into output rows for nodes other than the one they're found in.

To work with XML collections you need a solid understanding of XPath, which you can get from free tutorials such as this one from W3Schools.

The collector first writes any output specified for the root node, and then scans the document for elements that match the first XPath expression. After writing the specified output for the first matching element, if there is an expression nested inside the first expression it scans for matches to the nested expression. After traversing down the hierarchy of XPath expressions, the collector returns to the top expression and scans for a second matching element for it. When it has exhausted the matches for the first top-level expression it moves to the second one, and so on.

The dimensions that are output for any node are copied to the output for its child nodes. This enables the context of a node to be included on all CC Records containing its measures.

To set up regular collection and loading of data

  1. Create a new collection, choosing Xml File in the Collector Type Dialog.
    While creating the collection you must specify a data source. For information about XML data source fields, see 
    Data source properties.
    For information about other XML-specific settings in the Create Collection wizard, see Collector properties.
  2. Edit the advanced configuration to map output to CC Records.
    You might want to modify the default configuration created automatically by Cloud Cruiser.
  3. Schedule the collection to run as desired.

Measure qualifiers

The optional Measure Qualifier field lets you associate measures with a specific VM or other infrastructure item by adding the value of a specified dimension to their name. This results in measures being named differently across a set of collected data rows.

Prior to version 4.1, this field was named Resource Qualifier.

The name of every measure collected by a given XPath expression is prepended with the value of the dimension whose name you enter in this field. For example, the following measures might be output to a CC Record for a VM where the value of the dimension VMName is MyVM by an XPath expression that selects VirtualMachine nodes:

With no Measure Qualifier set vsphere.vm.cpu,2,vsphere.vm.mem,4096,vsphere.vm.disk,2535563782
With the Measure Qualifier VMName MyVM.vsphere.vm.cpu,2,MyVM.vsphere.vm.mem,4096,MyVM.vsphere.vm.disk,

Accumulating values in a record

By default, each XPath expression you specify produces one CC Record. But this can produce records with very few measures and dimensions, especially when you need to use XPath expressions to find several values, leaving the measures and dimensions for one logical object (such as a VM) spread over multiple records. To combine this data into fewer and larger records that provide better context to reports, you can use accumulation.

When you turn on accumulation for a node, its output fields are added to the record for the parent node instead of to a new record for the current node. For instructions, see Accumulate option. The following examples show outputs with and without accumulation for a parent VM node and three child nodes for its memory, disk, and CPUs:

Example without accumulation

The following CC Records were generated without using accumulation:

Example without accumulation - 3 CC Records

Example with accumulation

The following CC Records were generated using accumulation:

Example with accumulation - 1 CC Record

If no child of the Root node has accumulation enabled, when a record is retrieved for the root node that contains only dimensions, that record is not output to a CC Record. Its dimensions are still inherited by any records retrieved for child nodes.

Using variables to access values from other nodes

Sometimes a value that you want to use as a dimension on multiple records is located deep in the hierarchy of your XML document where you cannot retrieve it with dot notation from the node where you want to use it, and must therefore specify a separate XPath expression to retrieve it. This might cause the value to be written in just one CC Record instead of being part of a parent node that is inherited by multiple output records for the document. A variable lets you access this value from the node where it provides needed context.

Instead of capturing the value with an output field, you capture it with a variable. Then, in the node where you want the value to appear, you create an output field and use the variable, rather than an element from that node, as input. You can reference a variable in the node where you define it or any node that comes after it.

The most common use of a variable is to find a single value. When there are multiple elements in the XML document matching the XPath expression for the node where the variable is defined, the variable changes value with each match. It retains the value from the last matching element when referenced from later nodes.

For instructions, see Variables.

Last modified



This page has no classifications.

 (c) Copyright 2017-2020 Hewlett Packard Enterprise Development LP