San Diego VMUG October 2009 Recap
If you didn’t manage to make it to the San Diego VMUG you missed a pretty good show. Darin Pendergraft from Quest was there showing off EcoShell and I had cooked up a couple of demos of my own.
One of the more popular topics was a script I wrote to determine LUN latencies and the VMs that are writing to particular LUNs. One of the trickiest challenges when adopting virtualization is the effective use and partitioning of shared resources. Technologies like VMware DRS address exactly this challenge, but it’s safe to say that we’re still nearer the beginning than the end when it comes to automatic resource allocation and leveling.
On the other hand, PowerCLI and the vSphere API give you all the tools you need to monitor your environment, allowing you to proactively move or reallocate VMs away from storage hotspots. In particular I showed off a couple of scripts that tell you what your LUN read and write latencies are, as well as listing all VMs on a given LUN. The best part, the scripts are extremely simple, requiring less than 25 lines of code for both of these things! Don’t believe me? See for yourself:
You can easily adapt Get-VMHostLunLatency to run periodically (say, every night) to tell you if you’re experiencing any storage slowness. If you are you can easily follow that up with Get-LunVM to identify VMs that should be split off to separate LUNs. PowerCLI makes it all really simple.
Note that if you want to run Get-VMHostLunLatency against vCenter you will need to have your stats level set to 2 or higher.
As for the stuff I presented at the VMUG, I’ve posted my slides to slideshare:
And you can also download all the scripts I used here:

Will this work against NFS volumes? I would think not, but would be great if it did.
Posted by: Charles O'Brien | October 28, 2009 at 01:43 PM
No unfortunately there are no exposed performance stats for NFS datastores.
Posted by: Carter Shanklin | October 28, 2009 at 02:02 PM
Hi Carter,
I'm running your script but getting some errors, bu then some success. Any ideas?
04/11/2009 12:15:19 Get-Stat The metric counter "disk.totalreadlatency.average" doesn't exist for entity "svr-vmh-crcla08.lbcamden.net".
At :line:6 char:43
+ $stats = $VMHost | Get-Stat <<<< -stat disk.totalreadlatency.average,disk.totalwritelatency.average -maxsamples 1 -realtime |
04/11/2009 12:15:19 Get-Stat The metric counter "disk.totalwritelatency.average" doesn't exist for entity "svr-vmh-crcla08.lbcamden.net".
At :line:6 char:43
+ $stats = $VMHost | Get-Stat <<<< -stat disk.totalreadlatency.average,disk.totalwritelatency.average -maxsamples 1 -realtime |
Lun : vmhba0:0:17
ReadLatency : 20
WriteLatency : 14
Posted by: Paul | November 04, 2009 at 04:29 AM
What are the versions of the hosts that are failing? Looks like the last one is 3.5. Also are the failing ones ESX or ESXi?
Posted by: Carter Shanklin | November 04, 2009 at 02:56 PM