Home > Blogs > VMware PowerCLI Blog


Monitoring With PowerGadgets

While I wouldn’t go so far as to say that PowerGadgets is the greatest thing in the history of history, it is easily my favorite tool for Windows PowerShell, because of how easily it can be integrated with the VI Toolkit (for Windows) to create some great ways to monitor Virtual Infrastructure.

Getting insight into your entire Virtual Infrastructure

Currently it is not very easy to get an overall picture of your VMware Virtual Infrastructure using the VI Client. The VI Client comes with a number of nice charting tools, but for the most part they focus on one object at a time — a single VM, a single resource pool or a single host. How can we get a picture of the overall status of our Virtual Infrastructure?

The VI Toolkit (for Windows) includes a cmdlet called Get-Stat, which gives you raw access to the performance statistics of VMware objects. When we combine that with the Toolkit’s ability to easily retreive all of a certain type of object, it becomes easy to start making reports that cover the entire datacenter.

Here are two examples that illustrate the point. The first example, cpu.ps1 , creates a graph that shows us the average CPU utilization of all ESX hosts under management. (Note that if you want to run the script against your Virtual Infrastructure you will need to log in using the Get-VC cmdlet first.) Here’s a sample that I ran against my Infrastructure:

Cpu_3

In the same vein, memory.ps1 shows us the average memory utilization across all our hosts. Here’s the output I got when I ran against my systems:

Memory

Monitor All The Time

Another nice feature of PowerGadgets is the ability to publish a gadget as a Vista Sidebar. With this feature you could easily take the examples above and have a pervasive and continuously-updated view of the health of your Virtual Infrastructure, whether you are logged in through VI Client or not.

PowerGadgets: Worth the price?

PowerGadgets is not a free tool, so you’ll have to decide for yourself whether its benefits cover the costs. If monitoring your Virtual Infrastructure is important to you, you should at least download the trial and try it out, I think you’ll find that with the VI Toolkit (for Windows) and PowerGadgets it’s pretty easy to develop a gadget that monitors the things that are most important to you. If you’ve got feedback, or need a bit of help getting started, please share your feedback with us in the VI Toolkit (for Windows) Community.

6 thoughts on “Monitoring With PowerGadgets

  1. pfuhli

    Hmm I’ve got the same values for Memory usage and CPU usage when I use the scripts.
    Maybe it uses default ones?

    Reply
  2. Marco Shaw

    General:
    PowerGadgets also has a refresh feature, which is more helpful when creating a gadget. Passing -refresh 0:00:30 to out-gauge, for example, will cause PowerGadgets to re-run the VM commands every 30 seconds to get a new value to display. (Caution: The entire command string must be contained on one line.)
    Check out their MVP program:
    http://www.powergadgets.com/mvp
    pfuhli: I don’t have the VI toolkit installed so I can’t test this, but the scripts do appear to be OK, and the value isn’t 50 in both examples in the blog post.

    Reply
  3. W4nd3r3r

    I tried this and was able to get the gadgets to work but then they stopped. Some error about not supported protocol. I poked around and found I have 80 connected sessions in VI Client. Did I do something wrong?

    Reply
  4. Carter Shanklin

    W4nd3r3r,
    Are you using Marco’s suggestion of passing -refresh to out-gauge? If so you should make it so you don’t authenticate every time. You can do this using something like
    $host = get-vc
    get-vmhost -server $host … | out-gauge …

    Reply
  5. Ken

    I got this working with -refresh. Refresh seems to have some really screwy behavior in PowerGadgets.
    The short version of how I did it is that I made a separate script to get the value and then used that script as input to PowerGadgets ( .\getdata.ps1 viservername.myemployer.com | out-gauge -refresh 0:00:30 )
    Check my blog link for full details.

    Reply
  6. Tom

    I use PowerCLI 5 and vSphere 5
    The script works fine, but first refresh there is an error:
    You have modified the global:DefaultVIServer .. variables. This is not allowed. Please reset them to $null and reconnect via ConnectVIServer.
    But this doesn’t help
    Any Idea?
    Regards
    Tom

    Reply

Leave a Reply

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

*