ESXi Monitoring via Nagios

My current infrastructure budget does not allow for vSphere Server, ESXi 4.1 Enterprise, or OpsView Enterprise. They all have one thing in common: they’re more than $0. OK, I know OpsView comes in a community flavor, but still. ESXi hypervisor 4.1 is also free.

So originally I was going to just run SNMP monitoring through Nagios, but I found out that I needed to enable ESXi’s SNMP before I could attempt that. Long story short, ESXi’s SNMP is not worth monitoring. CIM, the supported protocol from VMWare, apparently is the route I needed to go.

So I found this site:
http://www.matthewjwhite.co.uk/blog/2010/02/09/monitoring-esxi-server-health-using-nagiosopsview/
Which gave me the direction I needed.

Log onto your Nagios Server:
apt-get install python-pywbem
cd /usr/local/nagios/libexec
wget http://communities.vmware.com/servlet/JiveServlet/downloadBody/7170-102-7-4233/check_esx_wbem.py
wget http://it.thelibrarie.com/utilities/check_esxi_hardware.py
chmod +x check_esxi_hardware.py

Check by running the following:
./check_esxi_hardware.py IPOFYOURESXISERVER root password VENDOR
You should receive a simple “OK” to verify everything is working

define command{
command_name check_esxi_hardware
command_line $USER1$/check_esxi_hardware.py -H $HOSTADDRESS -U $ARG1$ -P $ARG2$ -V $ARG3$
}

And the check as defined for one of my ESXi servers

define service{
use generic-service
host_name esx01
service_description ESXi Hardware Monitor
check_command check_esxi_hardware!readonlyuser!somepassword!dell
}

Verify it’s working after the check, you should have the green bar saying OK.

I had to edit a little bit as the previous script did not function through nagios although it did work via the command line. Nagios merely reported everything as OK even though I had errors reported on the CLI.

Leave a Reply

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