Monitoring View with Nagios

Monitoring View with Nagios


I thought I'd post this in here as I've searched high and low and found barely any information on this particular topic.

I've recently deployed Nagios within our company in order to monitor key hosts and services. In doing so this got me thinking how I could use Nagios to monitor certain things within VMware View. Having played around with Exchange PowerShell scripts and Nagios I started to look at VMware PowerCLI. I couldn’t work out a way to pull the information I wanted using the default PowerCLI commands so I started to have a dig around online. During my investigations I then came across the Unofficial VMware View PowerShell cmdlets.

Using the above I was able to extract the very information I was after, which I could then run through a script and ultimately report this back to Nagios. So with this in mind I set about writing some scripts for VMware View monitoring.

Having just experienced a major issue where all 350 View VMs went into an ‘already used’ state, meaning no one could logon, I thought what better place to start than to write a script to count the number of ‘problem desktops’ and then report this back to Nagios for alerting and notification purposes.

Using Get-Desktops within the unofficial cmdlets I was able to pull out the ‘state’ of each VM Desktop. This is then run through an ‘if’ statement to find ‘problem’ desktops and a count is produced. The count is then compared to the warning and critical levels defined within the script and then the script exits with the relevant code, 0, 1 or 2, to pass this back to Nagios along with the current number of problem desktops.

The script is executed on the View Connection Server itself using NSClient++ which is initiated by Nagios using a check_nrpe command. There is a great article on about executing PowerShell scripts using check_nrpe & NSClient++. - - In fact I followed the tutorials from that site for my entire Nagios build, they really are great.

One thing I also had to do was to amend the uadv_vmware_view.psm1 file included with the unofficial cmdlets so that it doesn’t print to screen when a successful connection is made to the View Connection Server. I just amended the ‘if’ statement within the psm1 file to achieve this, pretty simple. I have attached this below too.

So now I will get alerted by email and visually on our IT monitor when we hit a certain amount of ‘problem’ desktops, which is great as I don’t want to have to check the View Admin console every hour or so.

If anyone wants any further information please feel free to let me know and I’ll be happy to oblige.

This also leads me to think what else can be monitored within View using these cmdlets?

This document was generated from the following discussion: javascript:;

Version history
Revision #:
1 of 1
Last update:
‎07-05-2012 10:32 AM
Updated by: