VMware Cloud Community
HenrikElm
Contributor
Contributor

ESXi and UPS?

How should we plan with using UPSs with ESXi? As there is no SC to install any UPS agents that can shutdown servers/hosts etc, how is UPS/Power to be handled in an ESXi-based world?

Best regards

Henrik

Tags (3)
Reply
0 Kudos
23 Replies
Dave_Mishchenko
Immortal
Immortal

You could

1) Install the agent in the RCLI VM appliance and then have it shutdown the host (i.e. it would function pretty much like the service console does today).

2) Install the RCLI Windows package on your VC server and then have the UPS agent run a script which shuts down your host.

Reply
0 Kudos
HenrikElm
Contributor
Contributor

Hello!

Option 2 seems best to me in this case. What would be the command/syntax to shut down VMs and the hosts in a clean fashion? I can not seem to fins a suitable esxcfg-* command for that? I am very new to commandline work with ESX, so it may well be there, just that I dont know how to specify it..

Best regards

Henrik

Reply
0 Kudos
Berndt
Contributor
Contributor

have I got it right that both options require a physical host other than esxi that I connect my UPS to? If not how will the agent be informed of current outage? ESX(i) doesn't pass through usb devices, does it?

Reply
0 Kudos
gi-minni
Contributor
Contributor

Not necessarily, you can install the UPS agent into a virtual machine and connect the UPS via ip-address.If an UPS shutdown event occures, you can execute a vmcontrol.pl

command to the datacenter of your ESX3i server to shutdown immediately every running VM.

I am using the Linux apcupsd agent for APC Smart-UPS devices connected via the Web/SNMP management card.

Vmcontrol.pl ist part of the vi perl toolkit , please install it first and don't forget to connect your ethernet switch to your UPS receptacle.

Please keep in mind that ESX3i currently cannot connect the host serial port to a virtual machine or use any USB based UPS protocols.

Here the command:vmcontrol.pl --server <esxserver> --username <esxroot> --password <esxpasswd> --operation shutdown --datacenter ha-datacenter

Reply
0 Kudos
Berndt
Contributor
Contributor

Good point when using a APC > 3000 (network support). Will use this at our production site, thanks a lot!

For my home env this thread hides some possible solutions, in particular the belkin looks nice (EUR 70): A pity there's no linux support for the cheap way.

ng, Berndt

Reply
0 Kudos
trxman
Contributor
Contributor

does this mean that all VMs would be shuted down cleanly?

Reply
0 Kudos
depping
Leadership
Leadership

gi-minny, that's a cool solution!

Duncan

My virtualisation blog:

If you find this information useful, please award points for "correct" or "helpful".

Reply
0 Kudos
RParker
Immortal
Immortal

> does this mean that all VMs would be shuted down cleanly?

Only if you enable automatic shutdown / poweron of your VM's, and enabled your VM's in autostart. As the ESX host shuts down and this feature is activated, then the VM's will shutdown by script before the ESX host completely shuts down.

The problem with this is depending on your server, this can take longer in most cases than your UPS has battery.

Reply
0 Kudos
tosi_0083
Contributor
Contributor

I am Employee of Agency of ups Manufacturer,"nishiyama-denki corporation",japan.

I tried to Establishment of method "esx3i guestos & host shutdown".

The verification environment is constructed from two esx3i server & one virtual center installed server.

to shutdown, needs to install remote-cli and use remote-cli command,

then synchronizes ups software.

I have solution of ups shutdown,but it is Complexity When thinking about operation.

It is necessary to change according to the situation.

I am requesting correspondence to the manufacturer of japan ups.

if you are japan corporation,please contact with me.

Reply
0 Kudos
Berndt
Contributor
Contributor

since this thread is well found via goole I'll update it, maybe it's helpful for somone out there:

since esxi version 4.1 you can use usb passthrough from your esxi host to a vm. Smiley Happy

In my case (@home) i'm using a ups without network (but serial) support and it works perfectly with using a rs232 to usb adapter (the esxi hardware has no serial connectors too...)

ng, Berndt

Reply
0 Kudos
ThomasJensen
Contributor
Contributor

Hi Berndt.

I think your findings might be what saves me. I have the same scenario - homeserver that I want to use with ESXi 4.1 and a non-network UPS (APC Back-UPS CS type) which has USB.

Could I bother you with a request for elaboration on what your setup is like?

1. Is the UPS connected to only one vm or multiple vm? The underlying question is whether one UPS on one passthrough USB port can signal all vm instances that have a client running and get them to shutdown gracefully?

2. What happens to the ESXi when the UPS signals to the vm(s) and they shut down? I've read that the ESXi 4.1 is quite resilient to crashes, so one shouldn't be to concerned that this is left hanging when the vm(s) are shut down.

3. If the UPS can signal only one vm, what happens to the rest of the vm you have running? And what happens to the ESXi 4.1.?

It would be wonderful if it could work with several vm being asked to shutdown by one UPS - I don't feel like shelling out 4-500 euro on a SmartUPS with the network card - as well as 100 euro VMware software agent from APC (damn footpads - they should be wearing masks!)

BR,

Thomas

Reply
0 Kudos
Berndt
Contributor
Contributor

in my case the apc software is installed only on one vm, which is enough to shutdown all vms and the esxi host itself.

In "emergency" this software calls a batch skript that uses plink.exe to start the following killemall.sh on the esxi host:

#!/bin/sh

vim-cmd vmsvc/getallvms  | cut -d' ' -f1 | tail -n +2 | xargs -r -n1 vim-cmd vmsvc/power.shutdown
sleep 180
vim-cmd vmsvc/getallvms  | cut -d' ' -f1 | tail -n +2 | xargs -r -n1 vim-cmd vmsvc/power.off

./shutdown.sh

so it trys to shutdown all vms gracefully, if this won't work it powers off the vms. Afterwards it shuts down the esxi host.

hth, Berndt

PS: ssh has to be enabled on the esxi host and this script worked with esxi 3.5, to be honest I haven't tested it with esxi 4.x so far...

Reply
0 Kudos
clipper87
Contributor
Contributor

Berndt,

I'm not very familiar with ESXi but I do want to protect my ESXi system with a UPS. I have a APC SmartUps with USB.

Could you give step by step instructions on how to do it ?

How to enter the script

The batch file with a call to Plink etc

Much appreciated!

Frank

Reply
0 Kudos
Berndt
Contributor
Contributor

1.) connect your upc's usb cable to the esxi host

2.) in your vi-client add 2 devices to the vm that should control the upc, first an usb controller, secondly an usb device (and choose your upc)

3.) install the upc's software on you vm, the software should now be able to communicate with your upc

4.) download plink.exe and place it where your upc software can use it

5.) in the same folder create a shutdown_vms.bat with this content: plink.exe -l root -pw youresxirootpassword youresxihostnameorip ./shutdownvms.sh &

6.) in the same folder create a shutdownvms.sh with this content:

#!/bin/sh

vim-cmd vmsvc/getallvms  | cut -d' ' -f1 | tail -n +2 | xargs -r -n1 vim-cmd vmsvc/power.shutdown
sleep 180
vim-cmd vmsvc/getallvms  | cut -d' ' -f1 | tail -n +2 | xargs -r -n1 vim-cmd vmsvc/power.off

./shutdown.sh

7.) tell the upc software to start the shutdown_vms.bat in case of emergency

hth, Berndt

Reply
0 Kudos
clipper87
Contributor
Contributor

Thank you! Much appreciated!

Reply
0 Kudos
crescendas
Enthusiast
Enthusiast

Hi, where can I download this plink.exe for my APC and MGE UPS that is connected thru USB?

Thanks,

Boon Hong.

Reply
0 Kudos
admin
Immortal
Immortal

plink.exe is part of the putty package: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Reply
0 Kudos
crescendas
Enthusiast
Enthusiast

Thanks. Will plink.exe and the bat script works for ESXi 4.1 too?

btw, my Windows 2008 VM is able to detect APC USB connection but my Windows 2000 VM, while able to detect it, has exclaimation mark on it saying that the service cannot be started. Is there anyway to get UPS USB to work with Windows 2000?

Reply
0 Kudos
daiablo
Contributor
Contributor

I have attempted to follow this guide for ESXi 5 (free edition) but am having issues. When I run the shutdown_vms.bat file it is unable to find the shutdownvms.sh file.

shutdown_vms,bat, shutdownvms.sh and plink.exe are all in the same directory.

Any suggestions?

Reply
0 Kudos