Search Exchange

Search All Sites

Nagios Log Server Now Available - Download Now

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Vmware ESX & VM host

Bookmark and Share

Rating
34 votes
Favoured:
8
Compatible With
  • Nagios 2.x
  • Nagios 3.x
Owner
License
GPL
Hits
178401
Files:
FileDescription
check_esx.txtcheck_esx_v.0.2.0
check_esx3-0.5.plcheck_esx_v.0.5.0
Excellent plugin developed by OP5. Work with ESX4, vSephere. Entire DC can be monitored by quering through vCenter...




sage: esx_cpu.pl -D | -H [ -N ]
-u -p | -f
-l [ -s ]
[ -x ]
[ -t ] [ -w ] [ -c ]
[ -V ] [ -h ]


-?, --usage
Print usage information
-h, --help
Print detailed help screen
-V, --version
Print version information
--extra-opts=[[@]]
Section and/or config_file from which to load extra options (may repeat)

-H, --host=
ESX or ESXi hostname.

-D, --datacenter=
Datacenter hostname.

-N, --name=
Virtual machine name.

-u, --username=
Username to connect with.

-p, --password=
Password to use with the username.

-f, --authfile=
Authentication file with login and password. File syntax :
username=
password=
-w, --warning=THRESHOLD
Warning threshold. See
http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT
for the threshold format.
-c, --critical=THRESHOLD
Critical threshold. See
http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT
for the threshold format.
-l, --command=COMMAND
Specify command type (CPU, MEM, NET, IO, VMFS, RUNTIME, ...)
-s, --subcommand=SUBCOMMAND
Specify subcommand
-S, --sessionfile=SESSIONFILE
Specify a filename to store sessions for faster authentication
-x, --exclude=
Specify black list
-t, --timeout=INTEGER
Seconds before plugin times out (default: 30)
-v, --verbose
Show details for command-line debugging (can repeat up to 3 times)


Supported commands(^ means blank or not specified parameter) :
Common options for VM, Host and DC :

* cpu - shows cpu info
+ usage - CPU usage in percentage
+ usagemhz - CPU usage in MHz
^ all cpu info

* mem - shows mem info
+ usage - mem usage in percentage
+ usagemb - mem usage in MB
+ swap - swap mem usage in MB
+ overhead - additional mem used by VM Server in MB
+ overall - overall mem used by VM Server in MB
^ all mem info

* net - shows net info
+ usage - overall network usage in KBps(Kilobytes per Second)
+ receive - receive in KBps(Kilobytes per Second)
+ send - send in KBps(Kilobytes per Second)
^ all net info

* io - shows disk io info
+ read - read latency in ms
+ write - write latency in ms
^ all disk io info

* runtime - shows runtime info
+ status - overall host status (gray/green/red/yellow)
+ issues - all issues for the host
^ all runtime info

VM specific :
* cpu - shows cpu info
+ wait - CPU wait in ms
* mem - shows mem info
+ swapin - swapin mem usage in MB
+ swapout - swapout mem usage in MB
+ active - active mem usage in MB
* io - shows disk I/O info
+ usage - overall disk usage in MB/s
* runtime - shows runtime info
+ con - connection state
+ cpu - allocated CPU in MHz
+ mem - allocated mem in MB
+ state - virtual machine state (UP, DOWN, SUSPENDED)
+ consoleconnections - console connections to VM
+ guest - guest OS status, needs VMware Tools
+ tools - VMWare Tools status
Host specific :
* net - shows net info
+ nic - makes sure all active NICs are plugged in
* io - shows disk io info
+ aborted - aborted commands count
+ resets - bus resets count
+ kernel - kernel latency in ms
+ device - device latency in ms
+ queue - queue latency in ms
* vmfs - shows Datastore info
+ (name) - info for datastore with name (name)
^ all datastore info
* runtime - shows runtime info
+ con - connection state
+ health - checks cpu/storage/memory/sensor status
+ maintenance - shows whether host is in maintenance mode
+ list(vm) - list of VMWare machines and their statuses
* service - shows Host service info
+ (names) - check the state of one or several services specified by (names), syntax for (names):,,...,
^ show all services
DC specific :
* io - shows disk io info
+ aborted - aborted commands count
+ resets - bus resets count
+ kernel - kernel latency in ms
+ device - device latency in ms
+ queue - queue latency in ms
* vmfs - shows Datastore info
+ (name) - info for datastore with name (name)
^ all datastore info
* runtime - shows runtime info
+ list(vm) - list of VMWare machines and their statuses
+ listhost - list of VMWare esx host servers and their statuses
* recommendations - shows recommendations for cluster
+ (name) - recommendations for cluster with name (name)
^ all clusters recommendations


CHEC_ESX Version - 0.5 :
------------------------


Posted new Version 0.5.
Examples.....



ESX Base OS :
----------------

check_esx -H 10.8.3.115 -u xxx -p xxx -l cpu
CHECK_ESX OK - cpu usage=1169.82 MHz (4.99%) | cpu_usagemhz=1169.82Mhz;; cpu_usage=4.99%;;


#check_esx -H 10.8.3.115 -u xxx -p xxx -l cpu -s usage -w 80 -c 90 -t 60
CHECK_ESX OK - cpu usage=3.56 % | cpu_usage=3.56%;80;90


#check_esx -H 10.8.3.115 -u xxx -p xxx -l vmfs
CHECK_ESX OK - storages : Storage1=2287.00 MB (3.36%), Storage3=35440.00 MB (3.72%), Storage2=40352.00 MB (14.49%) | Storage1=2287.00MB;; Storage3=35440.00MB;; Storage2=40352.00MB;;

#check_esx -H 10.8.3.115 -u xxx -p xxx -l net
CHECK_ESX OK - net receive=4.40 KBps, send=0.30 KBps, all 1 NICs are connected | net_receive=4.40KBps;; net_send=0.30KBps;; OK_NICs=1;; Bad_NICs=0;;

#check_esx -H 10.8.3.115 -u xxx -p xxx -l io
CHECK_ESX OK - io commands aborted=0, io bus resets=0, io read latency=0 ms, write latency=0 ms, kernel latency=0 ms, device latency=0 ms, queue latency=0 ms | io_aborted=0;; io_busresets=0;; io_read=0ms;; io_write=0ms;; io_kernel=0ms;; io_device=0ms;; io_queue=0ms;;

#check_esx -H 10.8.3.115 -u xxx -p xxx -l runtime
CHECK_ESX OK - 3/4 VMs up, overall status=green, connection state=connected, maintenance=no, All 175 health checks are Green, no config issues | vmcount=3units;;

#check_esx -H 10.8.3.115 -u xxx -p xxx -l service
CHECK_ESX OK - services : ntpd (down), sshd (up), vmware-vpxa (up), vmware-webAccess (up)



VM checks from Base OS:
------------------------------

#check_esx -H 10.8.3.115 -N cs1 -u xxx -p xxx -l cpu
CHECK_ESX OK - "cs1" cpu usage=467.13 MHz(3.99%) wait=19626.20 ms | cpu_usagemhz=467.13Mhz;; cpu_usage=3.99%;; cpu_wait=19626.20ms;;




CHEC_ESX Version - 0.5 :
------------------------
Along with other improvement, It has new features like:

Cluster monitoring.
Storage (SAN - Luns/Paths/adapters etc).
Vmware Tools

I like the extra feature where you can call native nagios
options via vcenter or esx....

--extra-opts=[section][@file]
Read options from an ini file. See http://nagiosplugins.org/extra-opts for usage

















Reviews (23)
bypacketguy, March 5, 2014
@leejm_ca

Why would i want to compile all those things when it should work without, can give me some pointers on how to change the script to make use of whats already available?
bythehofman, February 13, 2014
Works great! Thank you very much!
I really appreciate author's great contribution.

Prior to make this fabulous plugin working on my CentOS 5.9 (32 bit), I need to do the following:

#yum install -y openssl-devel

Install the Perl module

#perl -MCPAN -e shell
cpan> install Nagios::Plugin
cpan> exit

If cpanminus is installed previously, we can install in such way:
#cpanm Nagios::Plugin

Install "VMware Infrastructure (VI) Perl Toolkit" (VMware-VIPerl-1.6.0-104313.i386.tar.gz OR VMware-VIPerl-1.6.0-104313.x86_64.tar.gz)

When done, this plugin works perfectly.
I added

$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;

to make it run. But now I always get this output


./check_esx3-0.5.pl -H 192.168.77.70 -u user -p mypassword -l cpu
*******************************************************************
Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client
is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER
together with SSL_ca_file|SSL_ca_path for verification.
If you really don't want to verify the certificate and keep the
connection open to Man-In-The-Middle attacks please set
SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.
*******************************************************************
at /usr/lib64/perl5/vendor_perl/5.12.4/LWP/Protocol/http.pm line 31
*******************************************************************
Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client
is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER
together with SSL_ca_file|SSL_ca_path for verification.
If you really don't want to verify the certificate and keep the
connection open to Man-In-The-Middle attacks please set
SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.
*******************************************************************
at /usr/lib64/perl5/vendor_perl/5.12.4/LWP/Protocol/http.pm line 31
*******************************************************************
Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client
is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER
together with SSL_ca_file|SSL_ca_path for verification.
If you really don't want to verify the certificate and keep the
connection open to Man-In-The-Middle attacks please set
SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.
*******************************************************************
at /usr/lib64/perl5/vendor_perl/5.12.4/LWP/Protocol/http.pm line 31
CHECK_ESX3-0.5.PL OK - cpu usage=8070.00 MHz (23.69%) | cpu_usagemhz=8070.00Mhz;; cpu_usage=23.69%;;



Would be perfect if this would be fixed
Script was fairly easy to setup; hardest part was getting the VMWare SDK/API for Perl to install properly.

Question: Is there a way to change the script such that the output to Nagios doesn't include the name of the script (in all caps) directly before the returned status?

All of my check results look like:
CHECK_ESX.PL OK - ...

I'd like to not have the check_esx.pl bit first. Note, this is the name of the script on my system as I renamed from what it's downloaded as for my ease of use
first in perl as other mentioned install Nagios::Plugin then install Crypt::SSLeay install Compress::Zlib install Class::MethodMaker
if you get the error "Permission to perform this operation was denied." the set Permissions on ESX (i) check. The created user must be in the group users and be placed under Permissions to Read Only.

if you get :
SSL_verify_mode of SSL_VERIFY_NONE for client is depreciated!
then #perl -MCPAN -e shell
#install GAAS/libwww-perl-5.837.tar.gz
#install GAAS/Net-HTTP-6.03.tar.gz
information got from the forum :
http://communities.vmware.com/message/2202177
xxx@myhost:/usr/local/nagios/libexec$ ./check_esx3-0.5.pl -H hostadress -u user -p password -l cpu
Undefined subroutine &Util::disconnect called at ./check_esx3-0.5.pl line 555.
bybaka69, February 2, 2013
Hi, i'm using this cool plugin since 2 weeks, it was not super easy to set up, but now that it is working, it's awesome !

I've just got one request. Is it possible to change de output in order to remove the "CHECK_ESX.PL" part in front of each output ?

CHECK_ESX.PL OK : ......

Thanks!

Ivan
bynagiostester, October 17, 2012
Does anyone face this problem ?
CPAN not able to install following Perl modules on the system. These must be
installed manually for use by vSphere CLI:

UUID 0.03 or newer
XML::LibXML::Common 0.13 or newer
XML::LibXML 1.63 or newer

I ran the check_esx3.pl , on my nagios server and it says installer has successfully installed both vSphere CLI and SDK for perl... enjoy, the vmware team. Did a bit of scrolling up and saw Esx3 UNKNOWN - Missing perl module VMWare::VIRuntime. Download and install Perl TOolkit available at ..vmware/download..
bybwjd, August 9, 2012
If you have the ability to use yum, you can use the following command to install all the perl necessities.

yum install perl-Nagios*
bysvissa, May 26, 2012
1. Works fine with MB Size
root@lankini:/usr/local/nagios/libexec# ./check_esx -H 172.16.16.51 -f authfile -l vmfs -s datastore1 -o used -w 67703
CHECK_ESX OK - Storages : 'datastore1'(used)=67703 MB (61.79%) | datastore1=67703MB;67703;

3. not fine with % style
root@lankini:/usr/local/nagios/libexec# ./check_esx -H 172.16.16.51 -f authfile -l vmfs -s datastore1 -o used -w 90
CHECK_ESX WARNING - Storages : 'datastore1'(used)=67703 MB (61.79%) | datastore1=67703MB;90;

4.
root@lankini:/usr/local/nagios/libexec# ./check_esx -H 172.16.16.51 -f authfile -l vmfs -s datastore1 -o used
CHECK_ESX OK - Storages : 'datastore1'(used)=67703 MB (61.79%) | datastore1=67703MB;;

PerfData structure Info ::
http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT

As per my understanding,
'label'=value[UOM];[warn];[crit];[min];[max]

[ UOM is Unit of Measure ]
1.min and max are not required if UOM=%
Here the script is using MBYTES

If the Script Can update the [min] and [max] fileds in the perf data output. Then We can use -w 90 ( % here) direclty to check on % basis
Else We have to use like -w 67703 ( -w MBSize ).
Giving size in MB for a number of DISK across different VM's is complex. If it is % basis then it is straight forward.

Please help in modifying the script to update [MIN][MAX] with min and max values in MB.

Here is the Example of C:\ Drive Space Check, This works perfectly.

1. root@lankini:/usr/local/nagios/libexec# ./check_nt -H 172.16.32.38 -v USEDDISKSPACE -p 12489 -s nagios124 -l c -w 80
c:\ - total: 15.00 Gb - used: 13.83 Gb (92%) - free 1.16 Gb (8%) | 'c:\ Used Space'=13.83Gb;12.00;0.00;0.00;15.00
2. root@lankini:/usr/local/nagios/libexec# ./check_nt -H 172.16.32.38 -v USEDDISKSPACE -p 12489 -s nagios124 -l c -c 90
c:\ - total: 15.00 Gb - used: 13.83 Gb (92%) - free 1.16 Gb (8%) | 'c:\ Used Space'=13.83Gb;0.00;13.50;0.00;15.00
'LABEL'=UOM;Warning;Critical;mininum;maximum
byXaneth, April 10, 2012
I can set up all the tests I need for my vCenter server, physical hosts and VM's. Awesome job. Once I got the VMWare Perl SDK installed and configured with all the necessary Perl modules (which the VMWare installer installed automatically), I was able to successfully run the script, but this is the error I got when trying some scripts against my hosts:

CHECK_ESX3.PL CRITICAL - Server version unavailable at 'https://...

This was due to the nature of the ESXi SSL certificate. I disabled SSL by adding the following near the top of my check_esx3.pl script, around line 32 or so:

$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;

Now it works great!!!
Hi,
I wanted to monitor the VM Esxi server, let me know what agents needs to be configured in ESX.

Please revert for any clarification.

Regards,
Raj.
bysdriver, March 28, 2012
In addition to the dependencies listed by leejm_ca (THANKS!) I also had to install Module::Implementation.
bybuckmaster60, February 18, 2012
Thanks to leejm_ca above. I finally got this working on centos 6.2 64bit, nagios 3.2.3. Perl is picky. Took me several hours, several. By the way this is running against a vSphere 5 infrastructure.

Thanks
byiso00, December 30, 2011
Mark, you're missing a few perl modules.

On Ubuntu
apt-get install libxml-perl libclass-methodmaker-perl libnet-ssleay-perl libcrypt-ssleay-perl
bybr, September 29, 2011
Very nice plugin. I'll echo what the others said on making sure you get the prereq's installed, but after that's done it works perfectly and reports on a lot of parameters for both VMs and DCs. The one nit I have is with setting warn and crit thresholds. Seems it works for some parameters like memory, but setting them to alarm for high datastore utilization doesn't seem to work.
byDoornenbal, June 22, 2011
1 of 2 people found this review helpful
Had this plugin quickly running, after installing VMware perl module's as stated in the help tekst.

I needed a good plugin to monitor VMFS usage. default this plugin shows your free space, but that's not what i wanted. use the -o used option to show your used space, as below:

check_esx3.pl -D $HOSTADDRESS$ -f ~/vm-vsphere -l vmfs -s SAN_SCSI_1 -w 450000 -c 475000 -o used

This is not well documented, but very usefull!
byalienryes, March 29, 2011
Initial set-up was no problem - just followed the instructions at the top of the check.

Having problems with getting it to work with anything other than the root account on our ESXi 4.1 hosts. Works fine at datacenter level but on the individual host no matter what we do we get

"Error: Permission to perform this operation was denied."

Any help appreciated.
bytntteam, January 10, 2011
1 of 1 people found this review helpful
Hi,

After installing the good perl module and vi toolkit, I could get it to work.

But the session file store doesn't seem to work, for me :

libexec/check_esx.pl -H ESXi -u 'login' -p 'pass' -l cpu -S test.session2

CHECK_ESX.PL OK - cpu usage=210.82 MHz (1.41%) | cpu_usagemhz=210.82Mhz;; cpu_usage=1.41%;;

libexec/check_esx.pl -H ESXi -u 'login' -p 'pass' -l cpu -S test.session2

CHECK_ESX.PL CRITICAL - Undefined subroutine &URI::_generic::port called at /usr/share/perl/5.10/VMware/VILib.pm line 236

Content of session file is like this :

cat test.session

#LWP-Cookies-1.0
Set-Cookie3: vmware_soap_session="\"some hash letters and numbers\""; path="/"; domain=ESXi.local; path_spec; discard; version=0


Any idea ?

Thanks
Page 1 of 2