Quantcast
Channel: Nickapedia » Microsoft
Viewing all articles
Browse latest Browse all 4

Look I’m A Tool! : vSphere Session Monitor 1.0

0
0
Patio hacking

(version 2.0 is now released! Go here)

So eight days ago I decided I was going to give another try to write an application that uses the VMware vSphere Web SDK. I had attempted this at least a year ago and never finished anything because of *insert excuse here*.

I always have ideas for cool (at least in my mind) tools swirling in my head. Even though I am a data center quadruple threat kind of guy (Microsoft, VMware, Cisco, and EMC), I like to do scripting and development to sharpen my mind. I always thought I was going to be a developer in college and love to turn ideas into reality.

So last week I fired up Visual Studio 2008 and started spending some nights coding. Along the way I found out some interesting things, caused a great blog post, and had a blast learning more about vSphere. I have a tendency to roll my challenges together and so decided to make this slick as possible including:

  • Making it a Tray Icon (A must for this app)
  • Doing all forms in WPF which I have never worked with before (XAML crash course)
  • Making all background processes multithreaded and eliminating the need for timers
  • Learning how to effectively use PropertyCollector.WaitForUpdates method to touch vCenter as little as possible
  • Building a proper MSI setup

On top of all this I went and wrote all the operations, connections, and credential pieces into classes for re-usability.  I am a bit of a perfectionist and probably went WAY overboard without much gain.

So without further self flagellation and glorification I present the: [drain file 2 url vSphere Session Monitor]

 

This little bad boy right here’s only purpose is to keep you informed of who is on your vCenter server.
Let me walk you through the steps to try it out.

Download the x86 installer from here: [drain file 2 url vSphere Session Monitor]

I do not endorse using this tool in production. Please test in a lab environment until you (if ever!) are comfortable using elsewhere.

Run the installer on the workstation of your choice. You must have .NET 3.5 installed. Also this workstation must have the ability to hit the vCenter Web SDK which is https://*your vCenter Server/sdk

After the application is installed, launch it from your new desktop shortcut or Program Files menu.

The application will prompt you for your vCenter fully qualified domain name (FQDN):

It will then prompt for you vCenter credentials:

If you entered everything correctly the tool will open up the main page:

And down in your notification tray a little pop-up will list current vCenter sessions:

 

Couple quick UI things to get out of the way:

  • To close the application, click the “X” in the main window.
  • Minimizing will hide the form. You can bring it back or hide it with a left-click on the notification tray icon.
  • If you right-click on the tray icon it will list the current users on the vCenter host.
  • The “Change Credentials” button will allow you to switch username and password. And the ‘Change vCenter Server” will let you change the FQDN you entered.

I bet at this point you are thinking: “Well Nick, that is cool and dandy but I can get that info from my vSphere client! Way to reinvent the wheel…”
Well… now for the best part. This is the real reason I wrote this little app. It all started with my senior engineer, Justin. He had a nasty habit of yelling out “What are you doing?” every time someone did something on a vCenter server. That got me thinking; “It would be cool if something popped up telling Justin someone logged in. And it would be even cooler if you didn’t have to have the vSphere Client running to do it.”
So with the vSphere Session Manager, the instant someone logs into your vSphere vCenter, you see this:

Not super fancy but if you want to know when someone is playing in your pool (like Justin) this will let you know.
Here are couple features I was going to add but will (maybe) later:

  • Storing of credentials (encrypted) – not too difficult, a little RSA key generation, mix in some environment specific salt, and dehydrate a class to XML.
  • Allow multiple vCenter hosts – You can open multiple monitors to watch each vCenter for now

So that is a few hours of my life dedicated to seeing how easy it is to utilize the VMware vSphere Web SDK. And from a datacenter guy I can definitely say that the documentation, community (thanks @sjin2008), and SDK made this a pretty easy task. I highly recommend everyone take your cool tool ideas and try something out too.

Do me a favor and leave comments with feedback/questions. Thanks!

 

.nick



Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images