I am not much of a bash script artist, but I know the logic that I need to use for an EXT that I think many VMware users would find handy. The purpose of this EXT is to provide a list of virtual machines that are allocated to the host, and indicate whether or not they are running.
I've tried to provide my logic below:
"vmware-cmd -l" needs to be run to get list of Virtual Machines allocated to the host
[root at HHCGVL-VMWA01 root]# vmware-cmd -l /vmfs/volumes/4a919549-2258d183-7668-001372540ee3/esXpress_VBAs/esXpress_Helper.hhcgvl-vmwa01.hhc.int.3/esXpress.vmx /vmfs/volumes/4bff448c-e7962c66-fbb4-001372540ee2/replica-49ae5498-5bcf-4bb7-9075-/replica-49ae5498-5bcf-4bb7-9075-.vmx /vmfs/volumes/4a919549-2258d183-7668-001372540ee3/esXpress_VBAs/esXpress_Helper.hhcgvl-vmwa01.hhc.int.1/esXpress.vmx /vmfs/volumes/4a919549-2258d183-7668-001372540ee3/esXpress_VBAs/esXpress_Helper.hhcgvl-vmwa01.hhc.int.2/esXpress.vmx /vmfs/volumes/4bff4a29-c7b1c616-8d51-001372540ee2/HHCDMZ-JUMP05 (OpenFire)/HHCDMZ-JUMP05 (OpenFire).vmx /vmfs/volumes/4bff1f3d-77949257-b4a5-001372540ee2/HHCGVL-ADMN01/HHCGVL-VMWA00.vmx /vmfs/volumes/4a919549-2258d183-7668-001372540ee3/esXpress_VBAs/esXpress_Helper.hhcgvl-vmwa01.hhc.int.4/esXpress.vmx /vmfs/volumes/4bff4a29-c7b1c616-8d51-001372540ee2/HHCDEV-ISIT01/HHCDEV-ISIT01.vmx
For each line %i :
"vmware-cmd %i getstate" needs to be run for red/green for each entry returned above
[root at HHCGVL-VMWA01 root]# vmware-cmd /vmfs/volumes/4a919549-2258d183-7668-001372540ee3/esXpress_VBAs/esXpress_Helper.hhcgvl-vmwa01.hhc.int.3/esXpress.vmx getstate getstate() = off
"/vmfs/volumes/" needs to be stripped from each entry
All text up to and including the first "/" needs to be trimmed
All text including and after the second "/" needs to be trimmed
"&red " or "&green " needs to be added to the beginning based off of getstate result
End Loop
Logic for excluding expected "down" machines
??????? exclude any line that includes "DEV" ???????? ??????? exclude any line that includes "esXpress" ?????? ??????? exclude any line that includes "replica" ?????? ??????? maybe provide a file or comma delimited list of terms to exclude ?????
add "red" or "green" at beginning as a summary
Add "************ERRORS*****************" if red
Add "***********All is Well*****************" if green
Place output in logs folder for upload to monitoring server
See example output below
Red Tue 09/01/2009 13:30:29.59 ***************ERRORS****************** &red HHCDMZ-JUMP05 (OpenFire) &green HHCGVL-ADMN01
Harold Ballinger IT Manager Heritage Healthcare, Inc. (888) 335-2620 | helpdesk (864) 244-3626 | office (864) 244-3093 | fax
[cid:image001.jpg at 01CB39FB.C7663590]
Visit our website: www.heritage-healthcare.com<http://www.heritage-healthcare.com/>
participants (1)
-
hballingerï¼ heritage-healthcare.com