Uncategorized

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:

Comments

5 comments have been added so far

  1. 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

  2. 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?

  3. I made some improvements to the Get-VMHostLunLatency function and posted them in poshcode. The improvements are:
    1. I added the VMHost name to the output.
    2. Made the function be able to use the pipeline.
    3. Removed the Get-Stat from the loop. This made the function much fatser.
    Edit by blog owner: Find the script at http://poshcode.org/2515

Leave a Reply

Your email address will not be published. Required fields are marked *