VMware

This Question is Possibly Answered

1 "correct" answer available (10 pts) 2 "helpful" answers available (6 pts)
1 2 Previous Next 17 Replies Last post: Jan 28, 2009 5:03 AM by hremul  

APC Network Shutdown on ESX3i posted: Jul 23, 2008 2:20 AM

Click to view gabyam's profile Novice 10 posts since
Jan 6, 2008

I want to shutdown a ESXi server automatically when battery on my APC Symmetra is 10% of runtime.

In ESX 3.5 I install APC Networkshutdown and with some script I shutdown VM and then ESX Server....

But in ESX3i how I can to do this?

Thanks

Re: APC Network Shutdown on ESX3i

1. Jul 23, 2008 5:06 AM in response to: gabyam
Click to view depping's profile Champion 2,997 posts since
Jan 17, 2005
There are no agents for ESXi because it hasn't got a service console. Your best bet would be scripting this and kicking of the script from another physical machine when power fails.

Duncan
My virtualisation blog:
http://www.yellow-bricks.com

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

Re: APC Network Shutdown on ESX3i

2. Jul 23, 2008 10:17 AM in response to: gabyam
Click to view community_mgr's profile Lurker 1 posts since
Jul 17, 2008

You can use the VI API to script the shutdown when you get to a critical power level. I assume you can get the APC information from a script as well. Here is a pointer to the VI Perl Toolkit:

http://www.vmware.com/support/developer/viperltoolkit/

Also for most configuration options have a look at the RCLI, it can be used to script configuration steps for ESXi:

http://www.vmware.com/go/remotecli

Here is the documentation for the RCLI:

http://www.vmware.com/pdf/vi3_35/esx_3i_e/r35/vi3_35_25_3i_server_config.pdf

Re: APC Network Shutdown on ESX3i

3. Jul 23, 2008 10:19 AM in response to: community_mgr
Click to view dilpreet's profile Enthusiast 49 posts since
Jun 28, 2008
Please reply to me if you have questions, I accidentally posted that from another account.

Re: APC Network Shutdown on ESX3i

4. Sep 7, 2008 5:43 AM in response to: gabyam
Click to view jhigham's profile Novice 10 posts since
Mar 29, 2007
gabyam,

I'm in the same situation as you. What did you end up using as your solution?


Thanks
John

Re: APC Network Shutdown on ESX3i

6. Sep 8, 2008 1:31 PM in response to: gabyam
Click to view dilpreet's profile Enthusiast 49 posts since
Jun 28, 2008
You should also be able to use an iLO or IPMI script to do the poweroff or put the machine in maintence mode from VC through VI API (we have a freely available Perl toolkit) if you want to migrate prior to shutdown. Is this not possible from APC? Basically, I don't understand why APC would need an agent running on the system itself?

Re: APC Network Shutdown on ESX3i

7. Sep 9, 2008 12:25 AM in response to: gabyam
Click to view gi-minni's profile Enthusiast 48 posts since
Mar 22, 2006
I solved the problem with a Web/SNMP network management card connected via IP to a VM box.
Then I compiled the apcupsd driver (http://www.apcupsd.org) inside a Linux VM box and in case of a
power failure I send the /sbin/poweroff command to the ESXi host via ssh using an identity file.

The trick is to enable the SSH server inside the ESXi host, build a dropbear and openSSH RSA
root key with at least 768 bit on it, put all the keys inside the oem.tgz file, disable root login and
for safety reasons enable only the execution of remote commands (append -g to ssh line inside
inetd.conf) and configure the shutdown and startup sequence of every VM boxes.

Beforehand I tried the PERL Toolkit and stumpled over the problem that sending a shutdown command
using the vmcontrol.pl command prevents the ESXi host to shutdown itself properly.

Please consider to use a big UPS in case you have plenty VM boxes to shutdown and don't forget to plan
the startup and shutdown sequence of all involved VM boxes with care.

Re: APC Network Shutdown on ESX3i

8. Nov 5, 2008 4:05 AM in response to: gi-minni
Click to view max70's profile Novice 14 posts since
Aug 12, 2008

Hi, i am trying to configure an esxi server to remotely shutdown via ssh.

I don't know where to put authorized_keys file for dropbear. Could you help me

thanks

Re: APC Network Shutdown on ESX3i

9. Nov 6, 2008 1:42 PM in response to: max70
Click to view Axis's profile Novice 22 posts since
Sep 2, 2005
I understand enabling SSH on ESXi works, but it's not supported by VMware (and it could be disabled in the future, no one knows). VMware itself tells you to use the remote CLI tools for this.. You must have a good reason to persist the ssh solution ;)

Re: APC Network Shutdown on ESX3i

10. Nov 6, 2008 3:52 PM in response to: gi-minni
Click to view Ritmo2k's profile Hot Shot 340 posts since
Jan 9, 2007
gi-minni,
Can you elaborate on how you made the keypair?

Thanks!

Re: APC Network Shutdown on ESX3i

11. Nov 6, 2008 11:05 PM in response to: Ritmo2k
Click to view Dave.Mishchenko's profile Guru 8,948 posts since
Nov 15, 2005
This isn't supported but here you go. I used puttykeygen to create the key pair.



1) Generate the public / private key pair
2) Edit /etc/passwd - add "root" to the root entry so the line will be like this
root:x:0:0:Administrator:/root:/bin/ash
3) Run mkdir -p /root/.ssh
4) Copy the public key to /root/.ssh/authorized_keys
5) Run chmod -R 700 /root
Attempt to login with your SSH client.

The bundle the /root folder into oem.tgz. You could also do /etc/passwd and /etc/inetd.conf, but I only tested the /root folder.

Re: APC Network Shutdown on ESX3i

12. Nov 7, 2008 8:33 AM in response to: Dave.Mishchen…
Click to view Ritmo2k's profile Hot Shot 340 posts since
Jan 9, 2007
Dave,
Simple instructions, appreciate it!
I am getting a message from dropbear saying server refused my key? I tried generating the keys with dropbearkey and putty.
I ended up making them on my CentOS vm and that worked...


Thanks!

Re: APC Network Shutdown on ESX3i

13. Nov 7, 2008 9:14 AM in response to: Ritmo2k
Click to view Dave.Mishchenko's profile Guru 8,948 posts since
Nov 15, 2005
Puttykeygen generated both a public key file and text to paste into authorized_keys. I used the text part (the public key file was formatted differently) so I end up with this in the file on ESXi.

ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAor/Mm2qGk+H+ZRNbjx/3e0Qz2cNEKEbzsFiYTO3znvwfWqJjzb7sD1bue9VnyyUEBu5ylMs0md9xZpZ/U6HIKwoDwckZQr4/48sHv7B3dU6I4pyD5H7bvpvnfK2Qh5/VCad5aGGKvdDrDzIv4K/l1uPso9PNIpzch9lEuD7il0k= rsa-key-20081106

Re: APC Network Shutdown on ESX3i

14. Nov 7, 2008 9:40 AM in response to: Dave.Mishchen…
Click to view Ritmo2k's profile Hot Shot 340 posts since
Jan 9, 2007

Good to know, I suspected it was the formatting.
I tried posting a reply on your page about the oem.tgz file and see you issue a chown 201:201 on /etc inside the tar file before you package it. I would need to add /root and /etc/passwd to my tar file but I don't understand who group 201 is? I don't even have a 201?

Thanks for all the help!

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities