Virtual machine metrics provide information about a virtual machine's performance and resource consumption in several categories.
VMware Cloud Director collects metrics for all running virtual machines. You can retrieve virtual machine metrics either as an instantaneous reading taken when the request is made, or as a collection of historic readings taken at regular intervals. Historic metrics are retained for 14 days, and can be retrieved whether or not the virtual machine is powered on.
The following categories of metrics are collected:
- cpu
- Virtual CPU usage metrics. CPU metrics are an aggregate of all the virtual machine's cores and sockets.
- disk
- Virtual hard disk capacity and performance metrics. When a virtual machine has multiple disks, metrics are reported as an aggregate for all disks.
- mem
- Virtual machine memory usage.
Rolled-Up Metrics for Organizations and VDCs
In a system configured for rolled-up metrics collection, AdminOrg and AdminVDC elements include links you can use to request cumulative metrics for VMs in all vApps in a VDC or in all VDCs in an organization. See "Install and Configure Optional Database Software to Store and Retrieve Historic Virtual Machine Performance Metrics" in the VMware Cloud Director Installation, Configuration, and Upgrade Guide.
Metrics Links in a Vm Element
When a virtual machine is powered on, the Vm element that represents it includes four links where the value of the type attribute has the form application/vnd.vmware.vcloud.metrics.*UsageSpec.xml
.
<Vm ... > ... <Link rel="down" href="https://vcloud.example.com/api/vApp/vm-4/metrics/current" type="application/vnd.vmware.vcloud.metrics.currentUsageSpec+xml"/> <Link rel="down" href="https://vcloud.example.com/api/vApp/vm-4/metrics/historic" type="application/vnd.vmware.vcloud.metrics.historicUsageSpec+xml"/> <Link rel="metrics" href="https://vcloud.example.com/api/vApp/vm-4/metrics/current" type="application/vnd.vmware.vcloud.metrics.currentUsageSpec+xml"/> <Link rel="metrics" href="https://vcloud.example.com/api/vApp/vm-4/metrics/historic" type="application/vnd.vmware.vcloud.metrics.historicUsageSpec+xml"/> ... </Vm>
- Use the links where
rel="down"
with a GET request to retrieve current or historic metrics in all categories. - Use the links where
rel="metrics"
with a POST request to retrieve a subset of current or historic metrics.
.../metrics/current
links are not returned in the
Vm element.
Negative Values for Current Metrics
Current metrics can be returned with negative values if the specific metric being requested does not have a valid current value. This condition can exist if you make a metrics request before the first collection interval for that metric elapses. For example, a request for CPU usage metrics made shortly after a virtual machine is powered on can report negative values.