There are no products in your shopping cart.
5 easy steps to monitoring your ESX hosts using Opsview
This post summarises the work involved to successfully monitor your ESX environment using Opsview and the vSphere SDK for Perl.
Prerequisites
Ensure you have the following:
- 1 x Opsview Master
- 1 x support account http://www.vmware.com/support/
- Installation of library libssl-devel
Step 1
Navigate and download the SDK Libraries that correspond to your OS Archictecture from http://communities.vmware.com/community/vmtn/developer/forums/vsphere_sdk_perl
Step 2
On the Opsview master run the following commands:
opsview@opsmstpr01:~$ sudo tar -zxvf VMware-vSphere-Perl-SDK-4.1.0-254719.x86_64.tar.gz opsview@opsmstpr01:~$ sudo vmware-vsphere-cli-distrib/vmware-install.pl Creating a new vSphere CLI installer database using the tar4 format. Installing vSphere CLI. Installing version 254719 of vSphere CLI You must read and accept the vSphere CLI End User License Agreement to continue. Press enter to display it.
Accept the licence agreement and the default location to install the executable files [/usr/bin]
Step 3
Download and Install the nagios plugin check_esx3 from http://exchange.nagios.org/directory/Plugins/Operating-Systems/*-Virtual-Environments/VMWare/check_esx3/details to /tmp
Step 4
On the Opsview master as user nagios run the following commands:
opsview@opsmstpr01:/tmp$ sudo chown nagios:nagios /tmp/check_esx3 opsview@opsmstpr01:/tmp$ cp /tmp/check_esx3 /usr/local/nagios/lib opsview@opsmstpr01:/tmp$ sudo cp /tmp/check_esx3 /usr/local/nagios/libexec/
Examples
On the Opsview master as the nagios user run the following tests for the VM server
./check_esx3 -H $HOSTADDRESS$ -u root -p password -l cpu ./check_esx3 -H $HOSTADDRESS$ -u root -p password -l runtime -s list ./check_esx3 -H $HOSTADDRESS$ -u root -p password -l io ./check_esx3 -H $HOSTADDRESS$ -u root -p password -l mem -s usage ./check_esx3 -H $HOSTADDRESS$ -u root -p password -l net ./check_esx3 -H $HOSTADDRESS$ -u root -p password -l runtime -s issues ./check_esx3 -H $HOSTADDRESS$ -u root -p password -l runtime -s status ./check_esx3 -H $HOSTADDRESS$ -u root -p password -l service ./check_esx3 -H $HOSTADDRESS$ -u root -p password -l storage -s path ./check_esx3 -H $HOSTADDRESS$ -u root -p password -l mem -s swap ./check_esx3 -H $HOSTADDRESS$ -u root -p password -l vmfs
On the Opsview master as the nagios user run the following tests for any Guest VM on the server
./check_esx3 -H [IP of ESX Server] -u root -p [Password] -N [Guest VM] -l runtime -s con ./check_esx3 -H [IP of ESX Server] -u root -p [Password] -N [Guest VM] -l cpu ./check_esx3 -H [IP of ESX Server] -u root -p [Password] -N [Guest VM] -l io ./check_esx3 -H [IP of ESX Server] -u root -p [Password] -N [Guest VM] -l mem -s usage ./check_esx3 -H [IP of ESX Server] -u root -p [Password] -N [Guest VM] -l net ./check_esx3 -H [IP of ESX Server] -u root -p [Password] -N [Guest VM] -l runtime -s cpu ./check_esx3 -H [IP of ESX Server] -u root -p [Password] -N [Guest VM] -l runtime -s issues ./check_esx3 -H [IP of ESX Server] -u root -p [Password] -N [Guest VM] -l runtime -s mem ./check_esx3 -H [IP of ESX Server] -u root -p [Password] -N [Guest VM] -l runtime -s status ./check_esx3 -H [IP of ESX Server] -u root -p [Password] -N [Guest VM] -l mem -s swap ./check_esx3 -H [IP of ESX Server] -u root -p [Password] -N [Guest VM] -l runtime -s tools
Step 5
Create an Opsview service check and host templates. For more information see our online documentation.


Comments
We are using the opsview community appliance and get the following error when trying to run check_esx3:
Can't locate Nagios/Plugin.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at ./check_esx3 line 31.
BEGIN failed--compilation aborted at ./check_esx3 line 31.
Any ideas?
I run a ubuntu server 10.04 as master.
For check_esx3 to function I had to install CPAN:
http://search.cpan.org/dist/Nagios-Plugin/
And the libs libmath-calc-units-perl libparams-validate-perl libconfig-tiny-perl
I did the following on opsview master server after the 5 steps:
$ sudo apt-get install libmath-calc-units-perl libparams-validate-perl libconfig-tiny-perl
$ wget http://search.cpan.org/CPAN/authors/id/T/TO/TONVOON/Nagios-Plugin-0.35.t...
$ tar zxvf Nagios-Plugin-0.35.tar.gz
$ cd Nagios-Plugin-0.35
$ perl Makefile.PL
$ make
$ make test
$ sudo make install
After this check_esx3 works for me.
Thank you.
Hi Michael,
For community support please head over to our Forums. Start at http://www.opsview.com/forums/opsview-community-edition/how-do-i
Tom
Nagios::Plugin is distributed with Opsview, but you need to reference the library location. Either: export PERL5LIB=/usr/local/nagios/perl/lib or in the perl code do a "use lib '/usr/local/nagios/perl/lib'".
Does this also work with ESXi 4.x?
Hi Anony mouse. Yes this does work with ESXi.4x. Vmware support docs at: http://www.vmware.com/support/developer/viperltoolkit/
One thing to note here is that the latest download is for vSphere 5.0 which doesnt seem to like the install in the same way. Make sure you download the vSphere 4.1 SDK
I have the same problem than Michael so I try the solution of Jirget but it isn't working for me... I still have an error at line 31...
Any ideas?
Thank's
Hello,
to get this script to work I had to add this line after the first qw() [line 30]:
working great.
Thanks.