How to shut down all the Virtual Machines when the UPS kicks in

electrical-powervmware-esxi

I have a Dell T610 running ESXi4, an APC Smart UPS 1000VA and a local "console" machine running Vista and the vSphere 4 Essentials pack. A dedicated management network is in place between the T610 and the Vista machine. The UPS has a USB and serial port. Currently it's connected to the console machine via USB.

We have 4 VMs: SBS 2003, Server 2003 running Terminal Services, and two XP Machines.

Ideally, when the UPS is forced to use battery power [for a set number minutes], I would like to gracefully shutdown all the VMs, then the ESXi, then the console machine. The latter two are not strictly a priority, but the VMs within ESXi are.

Google provided lots of deprecated scripts that used to work on ESXi 3.x or similar, however I am unable to find what they were deprecated by.

  • What do I need to be able to do this? I have Powerchute Express as supplied with the UPS, but would be willing to pay for software if required.

Best Answer

The UPS software is able to fire off a script at a point of your choosing after switching to batteries. Simply use that script to send appropriate commands. Rather than shut down the clients you could tell VMWare to save the current system state of the clients. Alternatively, have the script send remote shutdown commands to the clients using something like shutdown.exe or psshutdown.exe. Once those command are fired off have the script sleep for a suitable amount of time (sleep.exe) before shutting down the host.