In order to monitor VMware ESX and VM’s running on ESX, we will need to download and install a few items of software listed below, namely the VMware vSphere SDK for Perl and a Nagios plugin for checking ESX.

Firstly, we will need to get a terminal onto our Opsview server (via ssh, for example). Once on, “su -“ into root (if not already) and “cd /tmp”.

Once on, we will need to download the VMware SDK (mentioned earlier) from the VMware website. This will require you to have login access to

The file will be downloaded to the machine you are using to connect to your Opsview system, so we will need to either using ssh:// or WinSCP (depending on platform) to copy to the Opsview system. The file will resemble the following name:


Once you have copied the file to your /tmp, as root we will need to install the “openssl-devel” package, i.e. “apt-get install openssl-devel” for example (this will differ depending on your Opsview server platform, on Ubuntu 10.04 it was “libssl-dev” for example). Once installed, “cd /tmp” and run the following commands:

tar zxvf VMware-vSphere-Perl-SDK-5.0.0-422456.x86_64.tar.gz

cd vmware-vsphere-cli-distrib/


Once you run the command, you will be asked to read and confirm you agree with the user agreement. Once done, the SDK will be installed.

Next, we will need to download the ESX Plugin itself which will run on the Opsview server. Navigate here and download the plugin. Again, use winscp or ssh:// to transfer the file to your /tmp directory initially.

Once the plugin is on your Opsview server, navigate to /tmp in terminal and do “chmod +x” to make the check executable. Once done, we are ready to test the plugin is working successfully:

[email protected]:/tmp$ ./ -H ip -u user -p pw -l mem -s usage

CHECK_VMWARE_API.PL OK - mem usage=91.80 % | mem_usage=91.80%;;

Where “-H ip” is your IP address/host, “-u user” is your VMware username (i.e. root), and “-p pw” is your VMware users password. If the script is successful, you should see something similar to the output above.

Now we now it is working, we can add it to our plugins directory by copy to “usr/local/nagios/libexec/”, and then “chown nagios:nagios”.  We can now begin using this plugin from within Opsview.

Firstly, as we will be using attributes in our service checks due to the possibility of having many ESX hosts in our estate (See the Opsview article entitled "Using Attributes in Opsview V4" for more information), we will need to create 3 new attributes which we can subsequently apply to our VMware host.

To do this, navigate to “SETTINGS > ATTRIBUTES” and click the plus icon in the top left. Specify the name as “ESXUSER”, and “ESXPASSWORD” respectively for the 2 attributres. We already have the $HOSTADDRESS$ variable created by default.

Now we have the attributes created:

Monitoring VMware ESX

Next we need to create the service checks. To do this, navigate to “SETTINGS > SERVICE CHECKS” and click on the green arrow in the top left.  Here we can begin adding new service checks such as the one we tested using earlier.

After adding the information such as name/description/service group (may need to create a new one called “VMware ESX servers”, for example), we can choose our new plugin from the “Plugin:” drop down menu, and then add our arguments (inc. our new attributes) as below:

Check VMware

Once submitted, we can see our new service check below:

new vmware service check

Next, we will need to add the VMware host and apply our service check (and any others created). To do this, navigate to “SETTINGS > HOSTS” and click on the green plus sign in the top left. This will bring up a new “host template”, which we will need to populate similar to the screenshot below:

vmware host

Where IP/hostname is the address we reach our VMware ESX server on, and host title is what we want the ESX server to show up as in our monitoring.

Once this information is added, we now need to navigate to “ATTRIBUTES” and add the details for our “ESXUSER” and “ESXPASSWORD”, like so:

VMware attributes

This completes the configuration of the host, and gives us the 3 pieces of information we need (host/username/password) to access the VMware host and begin the monitoring.

Finally, we will need to navigate to “MONITORS”, and select the new service check we created, as below:

VMware ESX vSphere monitor

Once added, click submit and our new service check will be monitoring our new ESX host. As always, we will now need to apply these new configuration changes, via “SETTINGS  > APPLY CHANGES” and then apply configuration:

reload Opsview

Once reloaded, our new host and service checks will be available - active and monitoring!

vmware monitoring


There are many service checks we can do with this plugin, including monitoring individual plugins. For much more information and clarity, run the command  “./ -h” however, below are a few quick tips:

-H $HOSTADDRESS$ -N virtualmachine-u %ESXUSER% -p %ESXPASSWORD% -l cpu -s usage

Where “virtualmachine” is the VM we are wishing to run a check on. If we do not specify a VM, the command will be ran on the ESX server itself. “-l” is the main area, where “-s” is the sub area, i.e. the command output above (-h) shows:

Common options for VM, Host and DC :

        * cpu - shows cpu info

            + usage - CPU usage in percentage

            + usagemhz - CPU usage in MHz

So here, we have “cpu” as the “-l cpu” and “usage” as the “-s”, so the command would be “-l cpu -s usage”, for example. This applies to all the information available in “-h”.


Thanks to VMware for their SDK and Op5 for their VMware plugin.