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
289786
Files:
FileDescription
check_esx.txtcheck_esx_v.0.2.0
check_esx3-0.5.plcheck_esx_v.0.5.0
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
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)
bykamtec1, May 1, 2021
Great plugin but in 6.7 the hardware sensor status is not working
byvonhovic, January 28, 2020
Hello,

After we upgrade our ESX, script stop monitoring hardware sensor status. it shows problem:
Cannot report on the current health state of the element

Can somebody help me how can i resolve issue. This script is very good, but without solving my issue i cant use it.
byŚcibor, November 21, 2019
Hi,

a have a problem with this plugins:

./check_esx3-0.5.pl
Bareword "OK" not allowed while "strict subs" in use at ./check_esx3-0.5.pl line 630.
Bareword "UNKNOWN" not allowed while "strict subs" in use at ./check_esx3-0.5.pl line 98.
Bareword "CRITICAL" not allowed while "strict subs" in use at ./check_esx3-0.5.pl line 327.
Bareword "CRITICAL" not allowed while "strict subs" in use at ./check_esx3-0.5.pl line 380.
Bareword "CRITICAL" not allowed while "strict subs" in use at ./check_esx3-0.5.pl line 433.
Bareword "CRITICAL" not allowed while "strict subs" in use at ./check_esx3-0.5.pl line 475.
Bareword "CRITICAL" not allowed while "strict subs" in use at ./check_esx3-0.5.pl line 503.
Bareword "CRITICAL" not allowed while "strict subs" in use at ./check_esx3-0.5.pl line 541.
Bareword "CRITICAL" not allowed while "strict subs" in use at ./check_esx3-0.5.pl line 555.
Execution of ./check_esx3-0.5.pl aborted due to compilation errors.

Do you have a solutions ?
Hi ,

This scripts works very perfectly in my environment. but we need to use the key instead of username and password. Will that be possible to use the key authentication to the esx servers instead of username and password.
If possible just suggest me where the changes has to be done. Will try that too.

Hoping the reply for this.

Thanks in advance.
byBadia, January 24, 2017
Hi,

The check return a Critical (it seems by default) when CPU usage is 80 -c 90

It is possible to cancel this critical?

Thanks in advance.
byRick, December 2, 2016
I am setting this up with the 6.0 SDK, which has extra security measures re: certificates

I can run the Datacentre checks fine and the Guest checks fine but get a login error on the host checks- I've logged into the vSphere client fine using the same username and password and I am able to browse the settings of the host with no issues

I have tried running the esxcli directly but it is getting the same error- I've tried using the 'thumbnail' but once again the same login issue....

Any ideas?
byberia-pl, September 26, 2016
After install of all needed plugins and packages I'm able to run script:

./check_esx3-0.5.pl
Usage: check_esx3-0.5.pl -D | -H [ -N ]
-u -p | -f
-l [ -s ]
[ -x ] [ -o ]
[ -t ] [ -w ] [ -c ]
[ -V ] [ -h ]

Missing argument: command


So I assume there is nothing to add from perl/plugins/toolikts etc...

However I had a problem since after runing a command to check something like:

./check_esx3-0.5.pl -H IP.of.single.esx -u user -p password -l cpu

I see in Events on GUI that user was logged, but script running for 10 minutes without any output. What need to be checked?
bycroma, June 7, 2016
All my cheks are ok but each of them generates an identification and disconnection on vSphere . How to get around that?
byviierr, January 27, 2016
Hello

I tried to use this script on a debian 8 but I have the problem that
- if I call this check on a shell as root I will get an answer
- if I call this check on a shell as user nagios I will get an answer
BUT!! If the nagios-server will call this check I get the answer that I should install the perl-sdk??

Do you have any hints for me?

regards
Viktor
bypacketguy, March 5, 2014
0 of 1 people found this review helpful
@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
Page 1 of 2