5. Resource metering
Resource metering is a new feature of Windows Server 2012 designed
to make it easier to build solutions for tracking how cloud services
are consumed. Such tracking is important in both enterprise and hosting
scenarios. For example, if a hosting provider provides cloud-based
applications and services to customers, the hosting provider needs a
way of tracking how much resources those customers are consuming to
bill them for their use of these resources. Similarly, if a large
enterprise has deployed a shared private cloud that is accessed by
different business units within the organization, the enterprise needs
a way of tracking how much cloud resources each business unit is
consuming. This information may be needed for internal billing purposes
by the organization, or it may be used to help plan how cloud resources
are allocated so that each business unit gets its fair share of the
resources they need.
Previously, enterprises or hosting
providers who deployed shared private or public cloud solutions using
Hyper-V virtualization in Windows Server 2008 and Windows Server 2008
R2 had to create their own chargeback solutions from scratch. Such
solutions typically were implemented by polling performance counters
for processing, memory, storage, and networking. With the new built-in
resource metering capabilities in Windows Server 2012, however, these
organizations can use PowerShell to collect and report on historical
resource usage of the following metrics:
-
Average CPU usage by a VM
-
Average physical memory usage by a VM
-
Minimum physical memory usage by a VM
-
Maximum physical memory usage by a VM
-
Maximum amount of disk space allocated to a VM
-
Total incoming network traffic for a virtual network adapter
-
Total outgoing network traffic for a virtual network adapter
In addition, these metrics can be collected in a consistent fashion
even when the VMs are moved between hosts using Live Migration or when
their storage is moved using storage migration. And for billing of
network usage, you can differentiate between billable Internet traffic
and non-billable internal datacenter traffic by configuring network
metering port ACLs.
Implementing resource metering
As an example, let’s use resource metering to measure resource usage
for a VM on our Hyper-V host. We’ll start by enabling resource metering
for the VM SRV-A using the Enable-VMResourceMetering cmdlet, and then we’ll verify that resource metering has been enabled by piping the output of the Get-VM cmdlet into the Format-List cmdlet:
Now we can use the Measure-VM cmdlet to report resource utilization data on our VM:
You also can create resource pools for reporting usage for different
types of resources such as Processor, Ethernet, Memory or VHD. For
example, you could create a new resource pool named PoolOne using the New-VMResourcePool cmdlet:
Then, once you’ve enabled resource metering on the new pool using the Enable-VMResourceMetering cmdlet, you can use the Measure-VMResourceMeteringReset-VMResourceMetering cmdlet to reset the collection of resource metering data. cmdlet to report processor utilization for the pool. You also can use the
Resource metering data can be collected, retrieved and reported by combining different PowerShell cmdlets together using pipelines. To configure network metering port ACLs for differentiating different kinds of traffic, you can use the add-VMNetworkAdapterACL cmdlet.