A: Windows Server 2012 introduces the ability to track certain metrics for virtual machines (VMs):
- Average CPU usage, measured in megahertz over a period of time
- Average physical memory usage, measured in megabytes
- Minimum memory usage (lowest amount of physical memory)
- Maximum memory usage (highest amount of physical memory)
- Maximum amount of disk space allocated to a virtual machine
- Total incoming network traffic, measured in megabytes, for a virtual network adapter
- Total outgoing network traffic, measured in megabytes, for a virtual network adapter
To start the gathering of metric data for a VM, you use the Enable-VMResourceMetering Windows PowerShell cmdlet:
Enable-VMResourceMetering -VMName <virtual machine name>
To reset the counters, use this command:
Reset-VMResourceMetering
and to disable them, use
Disable-VMResourceMetering
To view the collected metrics, use this command:
Measure-VM cmdlet
Notice that in my example below, I pass the output object to the formal list (fl) alias to get full information you see below that (by default a table view is used which does not show all data). There is also a Measure-VMResourcePool cmdlet if resource pools are used.
PS C:\> measure-vm -Name savdaldc10 | fl
ComputerName : SAVDALHV01
VMId : 89173c3f-6d85-434e-80a0-9dd631a21d0e
VMName : savdaldc10
MeteringDuration : 00:01:33.9600000
AverageProcessorUsage : 171
AverageMemoryUsage : 2244
MaximumMemoryUsage : 2244
MinimumMemoryUsage : 2244
TotalDiskAllocation : 40960
NetworkMeteredTrafficReport : {Microsoft.HyperV.PowerShell.VMNetworkAdapterPortAclMeteringReport,
Microsoft.HyperV.PowerShell.VMNetworkAdapterPortAclMeteringReport,
Microsoft.HyperV.PowerShell.VMNetworkAdapterPortAclMeteringReport,
Microsoft.HyperV.PowerShell.VMNetworkAdapterPortAclMeteringReport}
AvgCPU : 171
AvgRAM : 2244
MinRAM : 2244
MaxRAM : 2244
TotalDisk : 40960