vCloud Director VM Utilization Metrics using PowerCLI

vCloud Director VM Utilization Metrics using PowerCLI

vCloud Director VM Utilization Metrics using PowerCLI

vCloud Director VM Utilization Metrics using PowerCLI – In this blog post we would see how we can use powercli to find the utilization metrics for a virtual machine within a orgvdc in vcloud director, we would be covering the CPU and Memory utilization statistics.

The script calculates metric units like memory, and CPU usage for the powered on VMs in the vCloud Director environment.

The script can be used to identify unused and under-utilized VMs in in a vCloud Director Organization.



vCenter View of the same performance counters.


In our test environment we had a deployment of vcloud director 5.5 and vsphere 6.0, i referred to an excellent blogpost written by Alan Renouf Linking your vCloud Director VMs and vSphere VMsRETRIEVING VM METRICS FROM VCLOUD AIR where alan talks about a cool function Convert-ToVM, Get-CIVMMetric which connects to both vcloud and vsphere using powercli and does a conversion of the vm shown in vcloud to a vsphere vm object.

During my test with this script and also in discussions with Alan i found that the support was included from vcloud director 5.6 onwards and the earlier versions were not supported.

Now in my environment upgrade was not that easy as there were large number of projects running on vCloud and getting a downtime was not that easy.

Hence i resorted to a little powershell magic to make this work, during my investigation i found that when ever a VM is created in vCloud director the resultant VM in the adjacent vcenter gets a guid appended to its name, using this I was able to co-relate  the names of the VM’s created in vcloud ovdc to the ones in vcenter.

Below diagram shows the entire work flow of the script.

vCloud Director VM Utilization Metrics using PowerCLI


Here you can see below the small script block which converts the VM information obtained from Get-CIVM cmdlet to the resultant vsphere VM object with the GUID appended to its name.

Once we extract the names of these vm’s, its pretty easy to extract the VM utilization metrics for these VM’s using the Get-Stat cmdlet, where i utilized the “cpu.usage.average”, “mem.usage.average” counters to extract utilization.

Also in Vcenter the interval mins for new data collection is 2 hours ==> 120 mins, so i set the same during my test.

Once the scripts completes execution, voila!! you would be greeted with a detailed CSV file with a monthly performance statistics for your vcloud vm’s based on which you can take necessary actions to clean up the VM’s or decrease the amount of resource assigned per VM.

Here’s the entire script for your reference, you can modify it as per your environment and reuse.

I hope this blog post helps out folks to get the performance metrics of VM’s who are using vcd 5.5 in their data-center environment.

Please follow and like us:

Share this post

Post Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.