Tag: ACL

Hyper-V VM Resource Metering

Hyper-V VM Resource Metering via PowerShell

With Windows Server Hyper-V, Microsoft introduced a new feature in Hyper-V called Resource Metering which allows you to measure the usage of a Hyper-V virtual machine (VM). This will enable you to track CPU, Memory, Disk, and network usage. This is a great feature, especially if you need to do chargeback or maybe even for troubleshooting.

Last week I had the chance to test and implement this feature for a customer. So here is my experience and how you can enable Hyper-V VM Resource Metering using PowerShell. Also, make sure that you have a look at the Microsoft Docs.

First, you can check the available PowerShell cmdlets for Hyper-V or for the commands which include VMResourceMetering.

Get-Command -Module Hyper-V
 
Get-Command *VMResourceMetering*

Get-Command VMResourceMetering

The resource metering has to be enabled per virtual machine. This is great, so even if you move the virtual machine from one Hyper-V host to another, you still have the usage data.

To enable resource metering, you can use the following cmdlet. In my case, I enable VM Resource Metering for my VM called SQL2012.

Get-VM SQL2012 | Enable-VMResourceMetering

 

Enable-VMResourceMetering

With the cmdlet Measure-VM, you can get the statistic for the VM. Simply run that comment to measure the Hyper-V VM usage.

Measure-VM -VMName SQL2012
 
Get-VM SQL2012 | Measure-VM | select *

Measure-VM

To get the network traffic use the properties of the NetworkMeteredTrafficReport.

(Measure-VM -VMName SQL2012).NetworkMeteredTrafficReport

Measure-VM NetworkMeteredTrafficReport

Here is another great thing, if you want to measure Network from or to a specific network you can use VM Network Adapter ACLs to do so. With ACLs, you can not just allow or deny network traffic, and you can also meter network traffic for a particular subnet or IP address.

Add-VMNetworkAdapterAcl -VMName SQL2012 -Action Meter -RemoteIPAddress 10.10.0.0/16 -Direction Outbound

add-vmnetworkadapteracl measure-vm

Of course, you can reset the statistics for the VM.

Get-VM SQL2012 | Reset-VMResourceMetering

reset-vmresourcemetering

And to disable resource metering for the VM use:

Get-VM SQL2012 | Disable-VMResourceMetering

 

I think this is one of the great new features of Windows Server 2012 Hyper-V which gets not a lot of attention but is essential.

If you want to know more about Resource Metering in Hyper-V, check out the blog post from Lalithra Fernando on the TechNet Virtualization Blog.

If you want to know more or have any questions, please feel free to leave a comment.



Error: Unable to get the private bytes memory limit for the W3WP process

Error

==================
Event Type: Error
Event Source: ASP.NET 2.0.50727.0
Event Category: None
Event ID: 1093
Date: 13.01.2011
Time: 11:11:50
User: N/A
Computer: Server01

Description:

Unable to get the private bytes memory limit for the W3WP process. The ASP.NET cache will be unable to limit its memory use, which may lead to a process restart. Error: 0x80070005

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
==================

Environment

  • Windows Server 2003
  • IIS 6
  • .NET 2.0 and 1.1

Summary

This Error is caused by the a know issue with permissions of the IIS metabase. The metabse ACL’s do not include the IIS_WPG group on the W3SVC/AppPools part in the metabase.

Solution

  • Download metaacl.vbs
  • Run the following command:
    cscript metaacl.vbs IIS://Localhost/W3SVC/AppPools IIS_WPG RE

More Information