Tag Archives: ESXi

Nagios Pi Part Three

Nagios Pi Part Three

Since my last post I’ve been mostly looking at how to start and shut down my environment at a certain times with success in starting but failure in shutting down.

The starting of my environment was an easy enough task with a simple bash script to send WOL packets to my hosts and using a For loop to fire it off five times for good measure.

Continue reading Nagios Pi Part Three

Nagios Pi – Implementing check_vmware_esx.pl

Nagios Pi – Implementing check_vmware_esx.pl

This article explains how to implement the check_vmware_esx.pl Nagios plugin on to a Raspberry Pi running Raspian Buster Lite.

The check_vmware_esx plugin has been developed by Martin Fuerstenau to monitor VMware through Nagios and is available on github here


In order to implement the check_vmware_esx.pl script the following pre-requisites must be met:

  • The following Perl modules installed:
    • File::Basename
    • HTTP::Date
    • Getopt::Long
    • Time::Duration
    • Time::HiRes
  • VMware Perl SDK is installed

VMware Perl SDK Installation

For this article I used the VMware Perl SDK 6.5 and rather than using the vmware-installer.pl I had to download the i386 version of the SDK and then followed the solution steps from stumpr which I found on the VMware communities site here.

Note: As stated in the thread VMware will not support the SDK installed in by this method.

tar zxf VMware-vSphere-Perl-SDK-6.5.0-4566394.i386.tar.gz
  • Copy the vmware-vsphere-cli-distrib/lib/VMware/share/VMware folder to /usr/share/perl5 using the following command
sudo cp -r /tmp/vmware-vsphere-cli-distrib/lib/VMware/share/VMware /usr/share/perl5/.
  • Download the check_vmware_esx-master .zip zip file from github and copy it to /tmp
  • Unzip the file using the following command:
unzip check_vmware_esx-master.zip
  • Copy the check_vmware_esx.pl script to /usr/local/nagios/libexec using the following command:
sudo cp check_vmware_esx.pl /usr/local/nagios/libexec/.
  • Copy the modules folder to  /usr/share/perl5/VMware using the following command:
sudo cp -r modules /usr/share/perl5/VMware/.

At this point when I tried to run the script I encountered the error error “Can’t locate help.pm in @inc (you may need to install the help module)” when running check_vmware_esx.pl

To resolve this error perform the following steps.

  • Edit the check_vmware_esx.pl script and find the line below:
#use lib "/usr/lib/nagios/vmware/modules";
  • Edit the line and change it to the line below:
#use lib "/usr/share/perl5/VMware/modules";
  • Save and exit the script

Testing it works

Once installed successfully you can test it from the command line by performing the following steps:

  • Change directory to /usr/local/nagios/libexec and execute the script to check the CPU on an ESXi host as follows:
sudo ./check_vmware_esx.pl -H -f authfile -S cpu

Note: I’m using an authfile for the authentication to my ESXi hosts but you can use the -u and -p options to provide a username and a password.

  • If all works then it should return something similar to the line below:
OK: CPU wait=317534.00 ms - CPU ready=554.00 ms - CPU usage=2.89%|'cpu_wait'=317534.00ms;;;; 'cpu_ready'=554.00ms;;;; 'cpu_usage'=2.89%;;;;