When you retrieve a subset of current or historic metrics, you can specify the metrics by name, or by using a pattern that includes a wildcard character.
Metric names are dot-separated strings.
A CurrentUsageSpec or HistoricUsageSpec can include MetricPattern elements that specify multiple metric names using a wildcard character. To form a metric pattern, replace any component of a metric name with an asterisk, which is a wildcard that matches all values of the metric name component it replaces. For example, this MetricPattern matches all metric names that begin with disk.
<MetricPattern>disk.*</MetricPattern>
The response would include these metric names: disk.provisioned.latest, disk.used.latest, disk.read.average, and disk.write.average.
A different MetricPattern matches all metric names that begin with disk and end with average.
<MetricPattern>disk.*.average</MetricPattern>
The response would include the metric names disk.read.average and disk.write.average.
A HistoricUsage element includes zero or more MetricSeries elements, each of which includes a set of Sample elements. Each MetricSeries has an expectedInterval attribute that specifies the interval, in milliseconds, at which the samples in the series are reported. Each Sample in the MetricSeries has a timestamp attribute noting the absolute time at which the sample was taken. You can use the timestamp and expectedInterval values to aggregate sample data, and to determine when metrics became unavailable because the virtual machine was powered off or unreachable.
A HistoricUsageSpec can include a time specification that constrains the result set to metrics collected between a start time and an end time. This time specification can be relative or absolute.
In RelativeStartTime and RelativeEndTime elements, start and end times are specified as an interval and a unit, which are interpreted as interval units ago. For example, this HistoricUsageSpec requests metrics collected during the past 8 hours.
<HistoricUsageSpec xmlns="http://www.vmware.com/vcloud/v1.5"> <RelativeStartTime interval="8" unit="hour"/> <RelativeEndTime interval="0" unit="hour"/> ... </HistoricUsageSpec>
You can also write this specification with no RelativeEndTime element, rather than a RelativeEndTime with an interval attribute value of 0. Both constructions specify an end time of now.
Alternatively, you can use AbsoluteStartTime and AbsoluteEndTime elements to specify absolute start and end times in a HistoricUsageSpec, as shown in this example, which returns metrics recorded during a one hour period:
<HistoricUsageSpec xmlns="http://www.vmware.com/vcloud/v1.5"> <AbsoluteStartTime time="2013-11-13T10:00:00.000Z" /> <AbsoluteEndTime time="2013-11-13T11:00:00.000Z" /> ... </HistoricUsageSpec>