In private cloud environments, you might have different scenarios for
each department, location, business unit, or even client, in the case
of service providers. One of the benefits a cloud can offer is the
ability to measure and bill your clients based on the current
consumption of services. Tracking utilization for these resources can be
difficult and complex, requiring proper applications and systems.
Hyper-V makes that simple with Resource Metering.
This allows you to track and measure the current usage for virtual
machines and resources pools, helping the IT department to bill clients
based on the usage of cloud resources.
These are some examples of metrics that can be collected with Resource Metering:
- Average, minimum, and maximum VM memory usage
- Average VM processor usage
- Total VM disk allocation
- Network traffic reports (incoming and outgoing)
- Resource pool measurement for all types of resources within a pool
With
Resource Metering, companies can implement advanced billing strategies,
creating a cost-effective way to track resource utilization, based on
virtual machines and resource pools.
You will see in this recipe
how Resource Metering can be enabled for virtual machines and resource
pools and how to extract its results.
Although
it is not configured by default, Resource Metering can be enabled on
every virtual machine in Windows Server 2012, using PowerShell. Make
sure you have a PowerShell console opened as administrator before you
begin.
The following steps will walk you through the Resource Metering PowerShell commandlets.
- To enable Resource Metering for all virtual machines in a host, type the following command:
- If you want to enable it for a particular virtual machine, type the following command, replacing
SYD-EX1
with the virtual machine name: - To extract the measurement details for a virtual machine, use the command
Measure-VM
, as shown in the following screenshot: - To see more Resource Metering details for a virtual machine, use the command shown in the following screenshot:
- To verify which virtual machine has Resource Metering enabled, type this command:
- For more details about inbound and outbound network utilization traffic, type the command shown in the following screenshot:
- To enable Resource Metering for a resource pool, type the following command to change the resource pool name to
Primordial
and the resource pool type to Memory
: - To measure the resource pool data, use the command
Measure-VMResourcePool
, as shown in the following screenshot. - Use the commandlet
Reset-VMResourceMetering
to reset the resource utilization data collected by Resource Metering.
The following command shows how to reset the data for a virtual machine
called SYD-SP1
: - To disable Resource Metering, use the command
Disable-VMResourceMetering
. The following command shows how to disable Resource Metering for a virtual machine called SYD-SP1
:
Although
there is no graphical interface to configure it, Resource Metering is
quite easy to manage using PowerShell. The commands let you enable,
measure, reset, and disable the counters for virtual machines and
resource pools. It is also easy to create reports with measurement
outputs, by using the output values to create advanced methods to charge
your clients based on utilization of resources.
The four resources that can be monitored on a VM are processor (in megahertz) and memory, network, and disk (in megabytes).
The
results can be collected and reset at any time, helping you to measure
the virtual machine or resource pool usage based on your company's
needs.
Now, with
resource utilization details, you can create your billing system or
simply track the resource information from your virtual machines and
resource pools.