BaldMansMojo / check_vmware_esx

chech_vmware_esx Fork of check_vmware_api.pl
GNU General Public License v2.0
124 stars 67 forks source link

Provide VM status (Normal / Warning / Alert) from data center / host #143

Closed dominikduennebacke closed 5 years ago

dominikduennebacke commented 5 years ago

I am trying to get a list of all VMs in my data center that have an alert (red) or warning (yellow) status. Basically this would require the script to check for the status attribute (Normal, Warning, Alert) of a VM which it currently only does when querying a VM directly by providing the name parameter (VM status = Overall status in output): ./check_vmware_esx.pl -f /etc/vsphere-auth -D vcenter.domain.tld --name vmname1 -S runtime --timeout 60

Critical! Connection state: connected - Power state: poweredOn - Overall status: red - Console connections: 0 - Guest state: running - Tools state: VMware Tools are installed, running and the version is current. - 0 config issues

Since I want to avoid querying all my VMs one-by-one, ideally the data center or ESX host query should provide the status attribute. Querying the VMs of a data center with listvms parameter currently only considers the state attribute (Powered on, Powered Off, Suspended): ./check_vmware_esx.pl -f /etc/vsphere-auth -D vcenter.domain.tld -S runtime -s listvms --timeout 60

0/5VMs suspended - 3/5VMs powered off - 2/5VMs powered on. vmname1 (poweredOn) vmname2 (poweredOn) vmname3 (poweredOff) vmname4 (poweredOff) vmname5 (poweredOff) |'vms_total'=5;;;; 'vms_poweredon'=2;;;; 'vms_poweredoff'=3;;; 'vms_suspended'=0;;;;

So perhaps there could be listvmsdetail parameter which provides detailed information about all VMs such as state, status and tools. Along with that there could be multiple subselect such as

BaldMansMojo commented 5 years ago

No. Checked it but it doesn't make so much sense to most people but it makes a lot of work. Information about which machines are running on a ESX host is a host object. Information about the tools is a check belonging to the virtual machine. Different object in API. To fulfill your request I have to