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.
In order to implement the check_vmware_esx.pl script the following pre-requisites must be met:
- VMware Perl SDK is installed
- The following Perl modules 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.
- Download VMware-vSphere-Perl-SDK-6.5.0-4566394.i386.tar.gz and copy to /tmp
- Unpacked the tarball using the following command
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:
- 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
- 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 192.168.0.100 -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%;;;;