List All VMS of Esxi or Cluster

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
CloudOps
Posts: 88
Joined: Mon Feb 08, 2016 12:52 am

List All VMS of Esxi or Cluster

Post by CloudOps »

Hi Everyone,

I am not able to get list of all VMS running on ESXI servers, Can anyone guide me how to list all VMS running on a particular ESXi ?

Plugin : https://exchange.nagios.org/directory/P ... pi/details

Code: Select all

[root@vm-nagiosxi-prod libexec]# ./check_vmware_api.pl -H 172.26.4.71 :\n -u nagios -p n@gi0s123 list
Usage: check_vmware_api.pl -D <data_center> | -H <host_name> [ -C <cluster_name> ] [ -N <vm_name> ]
    -u <user> -p <pass> | -f <authfile>
    -l <command> [ -s <subcommand> ] [ -T <timeshift> ] [ -i <interval> ]
    [ -x <black_list> ] [ -o <additional_options> ]
    [ -t <timeout> ] [ -w <warn_range> ] [ -c <crit_range> ]
    [ -V ] [ -h ]

Missing argument: command

Plugins options  :

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
Last edited by tmcdonald on Mon Mar 14, 2016 3:29 pm, edited 1 time in total.
Reason: Please use [code][/code] tags around long output
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: List All VMS of Esxi or Cluster

Post by tmcdonald »

You likely need to specify -l list instead of just list at the end.
Former Nagios employee
Locked