About Hyper-V

Hyper-V is the virtualization solution included in all Windows Server 2008 versions. It is tightly integrated in the operating system (OS) and other Microsoft products such as those of the System Center family. It delivers performance and features — such as high availability — at the level of the best competitors on the market, for example, Live Migration and, with the latest release in Windows 2008 R2 SP1, also Dynamic Memory. It also exposes a lot of internal functions and metrics to be used in scripts and other utilities, enabling you to automate deployment and other operations as well as allowing a precise monitoring of your virtualization infrastructure.

Monitoring Hyper-V

When it comes to monitoring virtualization, one of the major challenges is to identify which virtual machine is using which host resource. Windows Server provides several counters that help you identify how resources are consumed, some general and some specific to the Hyper-V subsystem.

The parameters to be monitored are:

% Processor Time
Processor is crucial for the smooth operation of virtual machines. And it is crucial to keep load average below 60-70%. If a VM is consistently using a lot of CPU it must be quickly troubleshooted or moved to another host.
In PowerShell you can get host performance metrics with this command:

Network transferred bytes
This is the amount of bytes that is received from or sent to the network. If the value is consistently above 50% of the adapter bandwidth, consider adding network adapters. Also monitor your network infrastructure to identify bottlenecks outside your Hyper-V host. For the host, select the counter instance related to the physical network adapters used by your virtual machines, for example:

Also monitor hard page faults that occur when memory pages are read or written from the disk. This value should stay below 500-1000 pages per second. The command is:

(get-counter '\Memory\Pages/sec').CounterSamples[0].CookedValue

Guest Virtual Machines memory
With the latest version of Hyper-V included in Windows Server 2008 R2 SP1, it is very easy to monitor VMs configured for using Dynamic Memory. The value of the counter Average Pressure measures memory availability, and below 100, it means that the VM has more memory than it needs, while above 100 means that the VM is not allocated the memory that it needs. A good value for this metric is 80.
The command is:

Once you have established a baseline, you will be able to set thresholds and alerts on the charted values, as we have spoken about in previous articles. If thresholds are exceeded frequently for a particular resource, you will have to plan for making available more hardware resource such as moving some VHDs on other physical disks, adding processors or network adapters.
For more on monitoring Hyper-V you can also read the following articles:

Uploading Values

Once the page and the Custom Monitors are created, we can upload values into them.
First you will have to request a Token as explained above. In order to upload values into custom monitors we have to know their assigned IDs and load them into a variable in order to avoid any further calls and improve performances.

About Hovhannes Avoyan

Monitis CEO – Hovhannes is an international entrepreneur with a recognized and respected reputation in the high tech industry. His technical expertise, combined with his drive to build the best business/product, has positioned him as a visionary international extension of Silicon Valley.