This content is part of the Essential Guide: The VMware infrastructure monitoring encyclopedia
Tip

Monitor VMware ESXi with your existing Nagios application

Many IT shops already use Nagios monitoring software. With a simple plug-in install and command definitions, Nagios can monitor VMware ESXi.

Nagios is plug-in-oriented management software typically installed on a Linux server. Many corporate system administrators...

use Nagios to keep track of the current state of their servers and other vital devices in the network. This makes Nagios a good choice if you're looking for VMware monitoring tools. Here's a look at how to integrate VMware ESXi monitoring in an existing Nagios environment.

Any device with a plug-in -- even the software in your department's coffeemaker -- can be managed through Nagios, which makes the open source network monitoring system popular and well-known. If you already have a Nagios monitoring environment in place, you can use it to monitor VMware infrastructures by installing the VMware plug-in on the Linux server.

The open source development company OP5 offers the most common VMware monitoring software plug-in: the OP5 Check ESX Plug-in. Since it is written in Perl scripting language, you'll need Perl support on your Linux server and the free VMware vSphere Perl SDK software.

Download the VMware vSphere Perl SDK to the Linux server that hosts Nagios and then extract it using tar zxvf VMware-vSphere-Perl-SDK-<version-number>.tar.gz. This will create the subdirectory called vmware-vsphere-cli-distrib. In this subdirectory, you'll find the installer script vmware-install.pl. Before running this script, use yum install perl-Pod-Perldoc perl-CPAN openssl-devel to ensure that all software requirements are met on your server.

After installing the prerequisites, use the ./vmware-install.pl command and follow the script's directions. Now, you can download the Nagios plug-in from OP5 or do an Internet search for download check_esx3.pl to find the plug-in script in text format. Download this script, save it to the directory /usr/lib64/nagios/plugins and use chmod +x check_esx3.pl to make it executable. Nagios can now begin monitoring ESXi.

You can now define the commands for Nagios to use to monitor VMware ESXi hypervisors. Add the monitoring commands to the Nagios /etc/nagios/objects/command.cfg file. Put a user name and password in variables in the /etc/nagios/resource.cfg file. In this example, a variable ESXUSER is defined, as well as the user's password. Nagios can use these credentials to access the ESXi host. The file could have the following contents:

# cat /etc/nagios/resource.cfg $ESXUSER$=username $ESXPASSWORD$=password

Based on this, you can add the ESXi monitoring commands to the /etc/nagios/objects/command.cfg file.

If you want to monitor ESXi CPU usage, use this command:
# check vmware ESXi CPU
define command
{    command_name   check_esx_cpu      command_line        $ESXUSER$/check_esx -H $HOSTADDRESS$ -u $ESXUSER$ -p $ESXPASSWORD$ -l cpu -s usage -w $ARG1$ -c $ARG2$ }

Once you've defined commands, create a configuration file for your ESXi host. If the ESXi host is called esxi01, you could put its configuration in a /etc/nagios/hosts/esxi01.cfg file containing the following:

# Host esx01

define host
{   use   Linux-server   host_name   esxi01 address 192.168.1.10   }

define service
{   use   generic-service   host_name   esxi01 service_description   ESXi CPU Load check_command   check_esx_cpu!80!90   }

This is just a taste of what you can do with the ESXi monitoring plug-in for Nagios. Depending on what functions the plug-in defines, you can monitor other aspects of the ESXi host. Work with your Nagios administrator to define more commands for monitoring VMware.

Dig Deeper on Using monitoring and performance tools with VMware

Virtual Desktop
Data Center
Cloud Computing
Close