Monday 11 April 2016

Monitoring vSphere with NAGIOS

In this tutorial we will look at how NAGIOS can be used to monitor different parts of your vSphere environment.

To get started we should firstly ensure that we have the relevent pre-requisites:

- vSphere SDK for Perl: https://developercenter.vmware.com/web/sdk/60/vsphere-perl
- Linux host (Debian, CentOS, RH etc.)
- check_vmware_esx (NAGIOS plugin): https://exchange.nagios.org/directory/Plugins/Operating-Systems/*-Virtual-Environments/VMWare/check_vmware_esx-2Epl/details

Firstly install the vSphere SDK

** Make sure you copy the perl modules within the check_vmware_esx to something like '/usr/share/perl5' **

Once the vSphere SDK for perl is installed - firstly ensure its working OK with something like:

/usr/bin/vmware-cmd --server vcenter.domain.com -l -h esxhost1 --username [email protected] --password 'yourpassword'

Which should return a list of your virtual machines on the specific ESXI host.

Now we will need to install a few pre-requisites:

yum install perl-Time-Duration
cpan install perl-Time-Duration-Parse

./check_vmware_esx.pl -D vcenter.host -u nagios -p mySec0reP@55w0rd* --select=volumes --subselect=Datastore1 --spaceleft --gigabyte -w 10% -c 5%

The above command will check the available free space on the specified datastore and return the percentage of free space.

Add the command to your command definitions and create a new service definition e.g.:

check_vmware_esx!vcenter.host!-u nagios -p mySec0reP@55w0rd* --select=volumes --subselect=Datastore1 --spaceleft --gigabyte -w 10% -c 5%

0 comments:

Post a Comment