ghettoHostShutdown41.pl

Version 2

    This script is an update to ghettoUPSHostShutdown.pl which worked with ESX(i) 3.5 and 4.0 hosts. The script is updated to support the recent library changes in vMA 4.1. It may work with earlier version, but they have not been tested.

     

    Defaults have been chosen for all of the previously required options, except the timeout option. That option remains required. The host_operation option is defaulted to "dryrun" to avoid accidental shutdowns. The vm_operation option uses the recommended "suspend" for quicker shutdowns. The ups_vm was changed to vma_name to emphasize that it is the display name of the vMA server. The short hostname of this server is used as its default. Although not originally required, logoutput was changed to default to STDOUT. The sendmail option was changed to a boolean, and if it is specified without a permanent logoutput file, a temporary one will be created.

     

    Besides these default changes, all of the previous robust capablities and features are available when shutting down your VMware environment in a

    time-critical situation, such as a power failure.

     

    Users have the option of specifying various shutdown operations for both the hosts ( shutdown/standby ) and VMs ( shutdown/suspend ) which also includes an option to utilize the auto startup/shutdown manager to prioritize the shutdown order of each VM on a given host. In addition, users can also specify a hostlist which will allow them to define the order in which hosts will initiate the power down sequence.

     

    A "dryrun" mode is available to ensure you've configured your shutdown process correctly without actually shutting down your systems. Hosts and VMs are processed asynchronously, blocking based on a configurable timeout value. A report of this script's activities can also be emailed.

     

    This script can be invoked by any UPS monitoring utility that runs on vMA such as the open source B and the script will automatically figure out which host the vMA VM is running on and ensure that all VMs are down prior to taking down the final host which runs the vMA VM. Though not recommended, this script could also be invoked from another VM or physical server, provided the vMA VM is properly configured.

     

    Note: Please follow the documentation and best practices from your UPS vendor. You will need to invoke this script as part of the UPS execution

    process to ensure your VMware environment will be shutdown.