Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

Check Hyper-V VM Health

Current Version
0.2
Last Release Date
2012-11-27
Compatible With
  • Nagios 2.x
  • Nagios 3.x
  • Nagios XI
License
GPL
Hits
113248
Files:
FileDescription
check_hyperv-health.shVersion 0.1 - Initial Release
check_hyperv-health.shVersion 0.2 - Bug Fix (See Full Description)
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
This Plugin checks that all virtual machines running on your Hyper-V server are in good health.

REQUIRES:

Check_NT Plugin
NSCLient++ or similar running on Server.

Command Format:

check_hyperv-health.sh $HOSTADDRESS$
This Plugin checks that all virtual machines running on your Hyper-V server are in good health.

REQUIRES:

Check_NT Plugin
NSCLient++ or similar running on Server.

Command Format:

check_hyperv-health.sh $HOSTADDRESS$

The Plugin accesses the performance counters on Server 2008 to check the health of all VM's running on Hyper-V.

Version History:
================

Version 0.2 -

* Added some basic error checking I forgot to add in Version 0.1 - Check will now return a "UNKNOWN" state if it fails to connect to the Client running on the server.

Version 0.1 - Initial Release.
Reviews (5)
Thanks monkinsane :). Simple and easy to use. need little fine tune who all are using password. Below is the change i made. Thanks monkinsane :)

added "PSW=$2"

changed line #10 to OKVMS=`$CHNT -H $HOST -s $PSW -p 12489 -v COUNTER -l "\Hyper-V Virtual Machine Health Summary\Health OK"`

changed line #11 to CRITVMS=`$CHNT -H $HOST -s $PSW -p 12489 -v COUNTER -l "\Hyper-V Virtual Machine Health Summary\Health Critical"`

changed line #15 to CMDERR=`$CHNT -H $1 -s $2 -p 12489 -v COUNTER -l "\Hyper-V Virtual Machine Health Summary\Health OK" |grep -i -o "could not fetch information from server"`
It works, but since my NSclient++ machines require a password, I had to add a 2nd variable to the command line and threw that variable in to the check commands in the script so that I could pass it my password. Once I did that, it worked. I wish it would be a little more verbose or you could specify one particular machine, but I realize this is probably a limitation of Hyper V itself and not the script. It's at least giving us some info which is better than nothing.
The plugins work fine. If your are a noob like me... first install on your Windows HyperV nsclient++ without password.

If you are on Centos, you have to change the line 8 by CHNT="/usr/lib/nagios/plugins/check_nt"
I had the same problem as Cipher, where the script would bail at line 13. Turns out the problem is that this script has hardcoded a path for the check_nt script (CHNT variable) it depends on (I believe it was the default location for debian-based systems), and in my case (running on CentOS), that script didn't exist in that location. After modifying the path, there was another error that came up, this time the error was in the OKVMS & CRITVMS variables--my particular NSClient machines require a password, and this wasn't supplying one. So adding a -s to the end of those variables fixed it, and the script now works.
Version 2 of the script bailed on line 13 in my Opsview Core installation.