Measuring Hyper-V VM resource use on Windows Server 2012

Written by Pawel Lakomski on Marzec 22nd, 2013

To check performance of virtual machine running on Windows Server 2012 Hyper-V hypervisor it is not even necessary to connect to Hyper-V Manager – all commands are passed via (remote) PowerShell. Anyway in the console all we get is the real-time information:

Hyper-V Manager

Hyper-V Manager

Not very impressing. But the PS way is much better and quicker. To get more in-depth information, first enable performance counters on a VM:

Enable-VMResourceMetering –VMName Name_of_your_VM

Enabling metering on a VM

Enabling metering on a VM

Too see the output run:

Measure-VM –VMName Name_of_your_VM

Checking performance

Checking performance

Now it is just a minute to write a script that will get the information every 15s. or 5 min or every hour and put it into csv file. Cool.

What other properties are available:

Methods and properties

Methods and properties

so we know also how long the counters are running  – so the script can stop gathering data after certain period.

How long it's been running?

How long it's been running?

It can also disable the counters with a simple cmdlet, yes, you guessed it:

Disable-VMResourceMetering –VMName Name_of_your_VM

There’s also a way to check performance for the whole resource pool. First I create a new recource pool of Ethernet type, I add a new NIC for my VM from this resource pool and finally I enable resource metering on the whole resource pool. Then a cmdlet Measure-VMResourcePool is used to get the data.

Measuring performance on resource pools

Measuring performance on resource pools

When we’re done, we can use Disable-VMResourceMetering cmdlet with -ResourcePoolName and -ResourcePoolType parameters to disable the metering on this resource pool. Finally we can check virtual machines and resource pools to see if there’s any with metering enabled:

Anything left?

Anything left?

That’s it. I guess I am used to awesome performance meters in vCenter and even better stats from esxtop on ESX(i) because I don’t find the performance measuring in Hyper-V very powerful. If you have SCVMM, it’s a different story.

 

Leave a Comment