Home > Blogs > VMware PowerCLI Blog


More Fun With PowerShell Mashups

A few weeks ago I blogged about using PowerGadgets to create custom dashboards to monitor Virtual Infrastructure performance. It was a great example of how easy it is to combine different domains within PowerShell.

Today I want to talk about a slightly different type of monitoring: alarms. VirtualCenter provides a very sophisticated alarm generation system. The problem is, what if you’re not in VirtualCenter watching the alarm tab? Wouldn’t it be better if alarms would reach out and find you wherever you are?

Again, PowerShell provides a very easy solution, due to the ease in which it combines different domains. The VI Toolkit (for Windows) makes it easy to get alarms from VirtualCenter, and /n software’s NetCmdlets makes it really easy to send instant messages. Combine the two and you have a monitoring solution that just about anyone can write and customize.

First, a bit of background: NetCmdlets provides a lot of really useful functionality to PowerShell, including sending email, logging into servers via SSH, downloading files via FTP and a lot more. As usual, the cmdlets come with a very easy syntax, built in documentation and are very easy to learn and use.

Taking that, and combining it with the VI Toolkit (for Windows), I wrote a script that monitors VirtualCenter for alarms and, when it sees new alarms, sends an IM using NetCmdlets. (Note that when you run the script, you are prompted for a login. This login is the login to your Jabber server, not to VirtualCenter.) NetCmdlets currently only supports Jabber as an IM protocol, but more protocols may be added in the future. If IM is not your thing, it’s also really easy to get NetCmdlets to send email instead.

Here’s an example of the results:

Imalarm

The best thing about this is it only took me a couple of hours to put together, and that was mostly due to alarms not being easy enough to access from the current version of the Toolkit (we’ll fix this in a later release, but the script above also contains a script cmdlet that returns all alarms.) Developing a solution like this using other technologies would have taken substantially longer, and wouldn’t have been as easy to customize when they were complete. This, to me, is the real power of PowerShell.

So, if you haven’t tried the VI Toolkit (for Windows) there’s no reason you shouldn’t download it today.

One thought on “More Fun With PowerShell Mashups

  1. Hal Rottenberg

    Very cool! I want to doubly thank you as both a powershell & VMware enthusiast, as well you know, and as the Webmaster for the Jabber client you are using in this screenshot. 🙂 Go Psi! (http://psi-im.org)

    Reply

Leave a Reply

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

*