Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_vmware_api
289290
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!
The plugin uses the VMWare API (via HTTPS) to do a wide variety of checks. You can check out the latest version with GIT at git://git.op5.org/nagios/op5plugins.git Requires the Nagios::Plugin CPAN module as well as the "VMware Infrastructure (VI) Perl Toolkit Packages" available from http://www.vmware.com/download/sdk/ See http://www.op5.com/support/documentation/how-to/400-monitoring-vmware-esx-3x-and-vmware-esxi for Nagios Command definitions, although the latest version of the script supports additional checks which aren't listed on that webpage yet, so you'll probably need to make a few more up.
./check_vmware_api --help
check_vmware_api 0.6.0
This nagios plugin is free software, and comes with ABSOLUTELY NO WARRANTY.
It may be used, redistributed and/or modified under the terms of the GNU
General Public Licence (see http://www.fsf.org/licensing/licenses/gpl.txt).
VMWare Infrastructure plugin
Usage: check_vmware_api -D | -H [ -C ] [ -N ]
-u -p | -f
-l [ -s ] [ -T ] [ -i ]
[ -x ] [ -o ]
[ -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.
-C, --cluster=
ESX or ESXi clustername.
-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
-o, --options=
Specify additional command options (quickstats, ...)
-T, --timestamp=
Timeshift in seconds that could fix issues with "Unknown error". Use values like 5, 10, 20, etc
-i, --interval=
Sampling Period in seconds. Basic historic intervals: 300, 1800, 7200 or 86400. See config for any changes.
Default value is 20 (realtime). Since cluster don't have realtime stats interval other than 20 is mandatory
--trace=
Set verbosity level of vSphere API request/respond trace
-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
+ memctl - mem used by VM memory control driver(vmmemctl) that controls ballooning
^ 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 (totalReadLatency.average)
+ write - write latency in ms (totalWriteLatency.average)
^ 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 time in ms
+ ready - CPU ready time 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) - free space info for datastore with name (name)
^ all datastore info
* runtime - shows runtime info
+ con - connection state
+ health - checks cpu/storage/memory/sensor status
+ storagehealth - storage status check
+ temperature - temperature sensors
+ 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
* storage - shows Host storage info
+ adapter - list bus adapters
+ lun - list SCSI logical units
+ path - list logical unit paths
* device - shows Host specific device info
+ cd/dvd - list vm's with attached cd/dvd drives
* uptime - shows Host uptime
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) - free space 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
+ listcluster - list of VMWare clusters and their statuses
+ tools - VMWare Tools status
* recommendations - shows recommendations for cluster
+ (name) - recommendations for cluster with name (name)
^ all clusters recommendations
Copyright (c) 2008 op5
check_vmware_api 0.6.0
This nagios plugin is free software, and comes with ABSOLUTELY NO WARRANTY.
It may be used, redistributed and/or modified under the terms of the GNU
General Public Licence (see http://www.fsf.org/licensing/licenses/gpl.txt).
VMWare Infrastructure plugin
Usage: check_vmware_api -D
-u
-l
[ -x
[ -t
[ -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.
-C, --cluster=
ESX or ESXi clustername.
-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
-o, --options=
Specify additional command options (quickstats, ...)
-T, --timestamp=
Timeshift in seconds that could fix issues with "Unknown error". Use values like 5, 10, 20, etc
-i, --interval=
Sampling Period in seconds. Basic historic intervals: 300, 1800, 7200 or 86400. See config for any changes.
Default value is 20 (realtime). Since cluster don't have realtime stats interval other than 20 is mandatory
--trace=
Set verbosity level of vSphere API request/respond trace
-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
+ memctl - mem used by VM memory control driver(vmmemctl) that controls ballooning
^ 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 (totalReadLatency.average)
+ write - write latency in ms (totalWriteLatency.average)
^ 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 time in ms
+ ready - CPU ready time 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) - free space info for datastore with name (name)
^ all datastore info
* runtime - shows runtime info
+ con - connection state
+ health - checks cpu/storage/memory/sensor status
+ storagehealth - storage status check
+ temperature - temperature sensors
+ 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
* storage - shows Host storage info
+ adapter - list bus adapters
+ lun - list SCSI logical units
+ path - list logical unit paths
* device - shows Host specific device info
+ cd/dvd - list vm's with attached cd/dvd drives
* uptime - shows Host uptime
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) - free space 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
+ listcluster - list of VMWare clusters and their statuses
+ tools - VMWare Tools status
* recommendations - shows recommendations for cluster
+ (name) - recommendations for cluster with name (name)
^ all clusters recommendations
Copyright (c) 2008 op5
Reviews (30)
byVivawest, December 12, 2013
This is a very good Check for our environment.
For those experiencing timeouts: Try to install libxml-libxml-perl ( sudo apt-get install libxml-libxml-perl on Ubuntu ) . The VMware vSphere SDK for Perl had a Output telling that it can't be found. After Installation the Checks via console were a lot faster (like 1 second) and i didn't get a timout on Icinga anymore.
For those experiencing timeouts: Try to install libxml-libxml-perl ( sudo apt-get install libxml-libxml-perl on Ubuntu ) . The VMware vSphere SDK for Perl had a Output telling that it can't be found. After Installation the Checks via console were a lot faster (like 1 second) and i didn't get a timout on Icinga anymore.
bywadcyr8_197, November 17, 2013
Hi,
this works fine on our infrastructure, but we get some issue donc vcenter database growing.
every check create a Login event and a logout event in the event table of the vcenter.
We get a lot of check (2 check per VM every 5min). That is generating millions of lines in the vcenter database which became very slow. We already reduce the event&task conservation time but not enough.
Does anyone know a way to limite the number of login to vcenter done by the check ?
this works fine on our infrastructure, but we get some issue donc vcenter database growing.
every check create a Login event and a logout event in the event table of the vcenter.
We get a lot of check (2 check per VM every 5min). That is generating millions of lines in the vcenter database which became very slow. We already reduce the event&task conservation time but not enough.
Does anyone know a way to limite the number of login to vcenter done by the check ?
byNooJ, November 13, 2013
Good check here.
Work like a charm when I launch this by command line (ie. ./check_vmware_api -H 192.168.2.25 -u supervision -p **** -l runtime -s status )
But when I launch this in NAGIOS I get : (Service Check Timed Out)
I already tried to install older Net-Http perl module (v 6.3)
perl -MCPAN -e shell
install GAAS/Net-HTTP-6.03.tar.gz
But nothing change.
Any help here ?
Work like a charm when I launch this by command line (ie. ./check_vmware_api -H 192.168.2.25 -u supervision -p **** -l runtime -s status )
But when I launch this in NAGIOS I get : (Service Check Timed Out)
I already tried to install older Net-Http perl module (v 6.3)
perl -MCPAN -e shell
install GAAS/Net-HTTP-6.03.tar.gz
But nothing change.
Any help here ?
Hi all,
for timeout issues with this plugin like:
/check_vmware_api -H xxxx -u root -p xxxx -l cpu
CHECK_VMWARE_API UNKNOWN - plugin timed out (timeout 30s)
the solution is to install older Net-Http perl module (v 6.3)
perl -MCPAN -e shell
install GAAS/Net-HTTP-6.03.tar.gz
for timeout issues with this plugin like:
/check_vmware_api -H xxxx -u root -p xxxx -l cpu
CHECK_VMWARE_API UNKNOWN - plugin timed out (timeout 30s)
the solution is to install older Net-Http perl module (v 6.3)
perl -MCPAN -e shell
install GAAS/Net-HTTP-6.03.tar.gz
byjarduini, April 26, 2013
There is a way to add a total datastorage usage and free space of the DC?
BTW excelent check!
Thanks a Lot
Javier
BTW excelent check!
Thanks a Lot
Javier
bygg, January 10, 2013
Hello,
is it possible to use it to monitor a NFS datastore latency ?
which would be the syntax?
thanks
is it possible to use it to monitor a NFS datastore latency ?
which would be the syntax?
thanks
byjerry123je, November 20, 2012
Hi guys,
I use this script on two of my nagios (different site)
one is now in use and with a very good reply.
another one has a big issue that after i installed basic component and vmware tool kit.this script can run with out error but only a time out output.
./check_vmware_api -H xxxx -u root -p xxxx -l cpu
CHECK_VMWARE_API UNKNOWN - plugin timed out (timeout 30s)
could anyone give some suggestion on this?
I use this script on two of my nagios (different site)
one is now in use and with a very good reply.
another one has a big issue that after i installed basic component and vmware tool kit.this script can run with out error but only a time out output.
./check_vmware_api -H xxxx -u root -p xxxx -l cpu
CHECK_VMWARE_API UNKNOWN - plugin timed out (timeout 30s)
could anyone give some suggestion on this?
byvallsit, July 19, 2011
You're writing - h 10.2.2.1 but -h is for showing the script help
In order to check that address you should type -H (in capital letters) host_address
In order to check that address you should type -H (in capital letters) host_address
bybinaryred, March 25, 2011
I have one complaint, in that the script defines a DataCenter as the vcenter, where a DataCenter should be a data center in vcenter. I have multiple sites with multiple machines at each site, organized into DataCenters at each site and clusters inside each DataCenter.
This brings me to my only request. It would be great to be able to get the stats on the clusters themselves. Stats on the vcenter cpu as a whole For example), doesn't help me when I have machines in multiple locations that can't interact with each other. Stats for Clusters would help me tremendously to see if I am running low on resources at a particular site, and if I need to add another ESXi machine or just increase the phyical memory on an ESXi machine.
Otherwise, after installing the VMware-vSphere-Perl-SDK modules, the script runs great and works very well. It could just be a bit better with my recommendations.
This brings me to my only request. It would be great to be able to get the stats on the clusters themselves. Stats on the vcenter cpu as a whole For example), doesn't help me when I have machines in multiple locations that can't interact with each other. Stats for Clusters would help me tremendously to see if I am running low on resources at a particular site, and if I need to add another ESXi machine or just increase the phyical memory on an ESXi machine.
Otherwise, after installing the VMware-vSphere-Perl-SDK modules, the script runs great and works very well. It could just be a bit better with my recommendations.
byrnygren, September 17, 2010
1 of 1 people found this review helpful
does anyone have an example of this script as a nagios service. I keep getting a config error. They dont seem to log the config errors in nagios.
I can run from command line. I tried combining ars named pair separate and together but still get error.
command line from libexec dir
check_esx -h 10.2.2.1 -l CPU -u ss -p wer
in config file
define service{
use local-service ; Name of service template to use
host_name frhg-vcenter
service_description CPU
check_command check_esx!- h 10.2.2.1!-u ss!-p wer!-l CPU
notifications_enabled 0
}
Any ideas or examples?
I can run from command line. I tried combining ars named pair separate and together but still get error.
command line from libexec dir
check_esx -h 10.2.2.1 -l CPU -u ss -p wer
in config file
define service{
use local-service ; Name of service template to use
host_name frhg-vcenter
service_description CPU
check_command check_esx!- h 10.2.2.1!-u ss!-p wer!-l CPU
notifications_enabled 0
}
Any ideas or examples?
Page 2 of 2