Friday, January 22, 2010

VMware powershell script for migrating to thin disks

With the advent of VMware 4.0, you now have the option to migrate VMs to thin disks. The only problem however, is that this feature is only available via the vSphere client and cannot be scripted into powershell.

A PowerShell function named Move-VMThin has been posted at that allows for migrating to thin disks from command line. Using this, you can easily queue up several migrations, while limiting the migrations to only 1 running at a time.

Monday, January 18, 2010

Creating a bell curve in excel - VMware

In reviewing the VMware performance data in my cluster, I wanted to identify what the average utilization was. Specifically, I wanted to know what the average MHz per Proc utilization was. The goal eventually being to put limits on the CPUs (x MHz per proc) and if you need more speed, then you buy more CPUs. This is similar to the "Compute Unit" model done by many cloud providers.

STEP 1: Get the average CPU for the last month
Using the below query, I get a report of the system name, number of CPUs, average MHz utilization for the last month, and average MHz/CPU
select v.Name
, avg(sd.stat_value) 'AvgTotalCPU'
, avg(sd.stat_value)/v.NUM_VCPU 'AvgProc'
from vpxv_VMs v
inner join vpxv_entity e on v.HostID=e.ID
INNER JOIN vpxv_entity_moid m (nolock) on m.EntityID=v.VMID
WHERE e.type_id=1
and stat_name='usagemhz'
and sample_time > getdate()-31
group by v.Name, v.VMID, v.NUM_VCPU
order by avg(sd.stat_value)/v.NUM_VCPU desc

STEP 2: Create the normal distribution in Excel
Using the information from, I imported the data into excel. Following the instructions I created the AVERAGE and STDEV functions and then exported them to a chart.