VMware VMUG Community
cam474
Contributor
Contributor

Auto shutdown of ESXi when UPS battery low

Hi,

Could anyone tell me if there is a way to shutdown the ESXi 5.0 server if there is a power outage and the UPS battery runs down?

I assume I could install the UPS software on the Windows VM and have the guest OS shutdown but what about the host?

I only use the free vSphere 5.0 client to administer  the host not vcentre.

Thanks in advance.

Cameron

Tags (1)
Reply
0 Kudos
3 Replies
galiacyj
Contributor
Contributor

Hey there !

I recently had to think of a solution to do this, here's what I've come up with.

This works with SSH-enabled ESXi host, I'm using ESXi 4.1 U1 (free licence) but this should work on version 5 too.

First, I've plugged my UPS with the USB cable to a dedicated machine running Windows (XP in my case, but that's not important).

Using the dedicated software of my UPS, I've set it to run a batch-script when UPS battery was low.

I then found, on the putty download page ( http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html via http://www.putty.org ) a tool called plink.exe

This is a command-line tool that allows you to create a ssh connection (or telnet or else - any connection putty can manage) and then execute one "line" of shell commands (nothing prevents you to do command1 & command2 etc.).

Next up, the batch script, pretty simple

@echo off

<pathtoplink.exe>\plink.exe -ssh -2 -pw <password> root@ip "command"

And that's it Smiley Happy

The command can be anything from a simple "halt" to a shell (.sh) script you've written and placed on your ESXi host.

Note : you can also use ssh keys to avoid using user/password, the plink tool works the same as putty Smiley Happy

I've tested this and it works perfectly, I'm also using this very useful tool to schedule backup tasks on the ESXi, without having to manipulate the rc.local or cron files Smiley Wink

Hope it helps Smiley Happy

ps : for this to work, the dedicated machine AND the network switches must be on some kind of UPS as well

Reply
0 Kudos
level365sean
Contributor
Contributor

If you are using APC UPS's, you can use PowerChute Network Shutdown to shut down any version of ESX/ESXi from version 4 forward.  You can find out more here.  Best of all, it's free!

Reply
0 Kudos
srnhpp
Enthusiast
Enthusiast

Please have a look..

Virtual Power
Reply
0 Kudos