Search Exchange

Search All Sites

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

Directory Tree

Vmware ESX & VM host

Rating
45 votes
Favoured:
11
Compatible With
  • Nagios 2.x
  • Nagios 3.x
Owner
License
GPL
Hits
286858
Files:
FileDescription
check_esx.txtcheck_esx_v.0.2.0
check_esx3-0.5.plcheck_esx_v.0.5.0
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
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 (32)
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
byMark, December 6, 2010
Its a very cool plugin - but i keep getting som SSL info every time i run the file:
./check_esx.pl -v -H 100.100.100.100 -N xWeb -u xxx -p xxx -l mem -s usage -w 80 -c 90 -t 60
SSL_connect:before/connect initialization
SSL_connect:SSLv2/v3 write client hello A
SSL_connect:SSLv3 read server hello A
SSL_connect:SSLv3 read server certificate A
SSL_connect:SSLv3 read server certificate request A
SSL_connect:SSLv3 read server done A
SSL_connect:SSLv3 write client certificate A
SSL_connect:SSLv3 write client key exchange A
SSL_connect:SSLv3 write change cipher spec A
SSL_connect:SSLv3 write finished A
SSL_connect:SSLv3 flush data
SSL_connect:SSLv3 read finished A
SSL_connect:before/connect initialization
SSL_connect:SSLv2/v3 write client hello A
SSL_connect:SSLv3 read server hello A
SSL_connect:SSLv3 read server certificate A
SSL_connect:SSLv3 read server certificate request A
SSL_connect:SSLv3 read server done A
SSL_connect:SSLv3 write client certificate A
SSL_connect:SSLv3 write client key exchange A
SSL_connect:SSLv3 write change cipher spec A
SSL_connect:SSLv3 write finished A
SSL_connect:SSLv3 flush data
SSL_connect:SSLv3 read finished A
SSL_connect:before/connect initialization
SSL_connect:SSLv2/v3 write client hello A
SSL_connect:SSLv3 read server hello A
SSL_connect:SSLv3 read server certificate A
SSL_connect:SSLv3 read server certificate request A
SSL_connect:SSLv3 read server done A
SSL_connect:SSLv3 write client certificate A
SSL_connect:SSLv3 write client key exchange A
SSL_connect:SSLv3 write change cipher spec A
SSL_connect:SSLv3 write finished A
SSL_connect:SSLv3 flush data
SSL_connect:SSLv3 read finished A
CHECK_ESX.PL OK - "xWeb" mem usage=22.99 % | mem_usage=22.99%;80;90

can this SSL info be disabled somehow?
byC4Vette, December 2, 2010
0 of 1 people found this review helpful
Very nice, thank you!
It was indeed necessary to follow leejm_ca's notes. I have it working in Opsview on a Ubuntu-server now monitoring four ESXi hosts running vSphere 4.1
byleejm_ca, August 13, 2010
6 of 8 people found this review helpful
Prerequisites:

I ran into a lot of issues trying to get this plugin to work on my Nagios RedHat 4_Update6 host. Such as…. I received errors when using an old version of CPAN to download, build and install Perl modules required by the check_esx3.pl plugin. To resolve this I upgraded Nagios server to Redhat 5_Update 6 and also received a few awesome suggestions from the Nagiosplug-help communities.

Using the advice I was given I then took the following steps:


- Downloaded check_esx3.pl from Nagios Plugin Exchange
- As per check_esx.txt, I downloaded and installed “VMware-vSphere-Perl-SDK-4.1.0-254719.i386.tar.gz “

- I then ran the ./check_esx3.pl script and received the error:

Can't locate Nagios/Plugin.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at ./check_esx3.pl line 31.
BEGIN failed--compilation aborted at ./check_esx3.pl line 31.

- Using CPAN I installed the requested module: #perl -MCPAN -e 'install Nagios::Plugin'

-Tried ./check_esx3.pl and received error:

Can't locate Params/Validate.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin/Functions.pm line 11.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin/Functions.pm line 11.
Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin.pm line 4.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin.pm line 4.
Compilation failed in require at ./check_esx3.pl line 31.
BEGIN failed--compilation aborted at ./check_esx3.pl line 31.


- Using CPAN I installed the requested module: # perl -MCPAN -e 'install Params::Validate'
-Ran ./check_esx3.pl and received error:

Can't locate Math/Calc/Units.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin/Functions.pm line 12.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin/Functions.pm line 12.
Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin.pm line 4.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin.pm line 4.
Compilation failed in require at ./check_esx3.pl line 31.
BEGIN failed--compilation aborted at ./check_esx3.pl line 31.


- Using CPAN I installed the requested module: # perl -MCPAN -e 'install Math::Calc::Units'
- Ran ./check_esx3.pl and received error:

Base class package "Class::Accessor::Fast" is empty.
(Perhaps you need to 'use' the module which defines that package first.)
at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin.pm line 11
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin.pm line 11.
Compilation failed in require at ./check_esx3.pl line 31.
BEGIN failed--compilation aborted at ./check_esx3.pl line 31.


- Using CPAN I installed the requested module: perl -MCPAN -e 'install Class::Accessor::Fast'
- Ran ./check_esx3.pl and received error:

Base class package "Config::Tiny" is empty.
(Perhaps you need to 'use' the module which defines that package first.)at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin/Config.pm line 6
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin/Config.pm line 6.
Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin/Getopt.pm line 16.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin/Getopt.pm line 16.
Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/Nagios/Plugin.pm line 64.


- Using CPAN I installed the requested module: perl -MCPAN -e 'install Config::Tiny'

- Now able to run ./check_esx3.pl

Usage: check_esx3.pl -D | -H [ -N ]
-u -p | -f
-l [ -s ]
[ -x ]
[ -t ] [ -w ] [ -c ]
[ -V ] [ -h ]
Page 2 of 2