Invite a Co-worker
Send a co-worker an invite to the Exchange portal.Just enter their email address and we’ll connect them to register. After joining, they will belong to the same company.
Send Invite Cancel
80771members
346785posts

ESX 5.1 shutdown script on vMA

Solved
tj500_apc
Crewman
Crewman
0 Likes
5
233

ESX 5.1 shutdown script on vMA

This was originally posted on APC forums on 5/30/2013


Hey all I'm back again!

Please reference http://forums.apc.com/thread/14127 for my previous thread related to this.

We have an HP Proliant ML350P Gen 8 with an ESX 5.1 installed on it.  We will eventually be converting a Windows Server 2003 VM on it and we need to add a graceful shutdown option to the server.  We bought a SmartUPS 1500 to manage the power for the server.  I then followed the instructions found here in the link below to install vMA and set up PowerChute Business Edition:

http://www2.schneider-electric.com/resources/sites/SCHNEIDER_ELECTRIC/content/live/FAQS/165000/FA165...

The server is connected to the UPS via a Serial to RJ-45 cable and we are using PCBE 9.1.0 as the UPS manager program.  I get everything installed and configured the shutdown order of the machines on the vSphere.  I am now creating the shutdown script through the instructions shown on this link:

Setting up an APC UPS in ESXi

Essentially I create a shell script with the following:

#!/bin/sh

#

ssh root@192.168.150.20 halt

(192.168.150.20 is the ESX host address).  It should also be noted that we have shared keys that allow root login without a password to the ESX host (I know this is a security risk but I can find no other way to get this to work).  I save this as 'ServerShutdown.sh' in the PCBE directory (/opt/APC/PowerChuteBusinessEdition/Agent/cmdfiles) and then use sudo chmod +x ServerShutdown.sh to add the permissions for executing it.  Once I do so it shows up in the list of command files in the web browser session for PCBE as expected (Under Shutdown settings).  However when I apply the changes and try to test a shutdown nothing happens.  I unplug the UPS from the wall and it doesn't perform a graceful shutdown.  The strange thing is that when I run the shell from the command line without using the sudo prefix it works (I just type 'sh ServerShutdown.sh').  Is there some special permission we have to set to allow the script to run from the PCBE agent?

I hope I didn't drone on too long I just want to make sure you have enough details to solve the problem without having to ask for more info!  Thanks in advance for the help!!


Accepted Solutions
BillP
Administrator Administrator
Administrator
0 Likes
0
233

Re: ESX 5.1 shutdown script on vMA

This reply was originally posted by Bill on APC forums on 6/3/2013


Did PowerChute record the loss of AC power in the event log? If it did then depending on your configuration the Host should have been notified to power down. Are you running a licensed version of ESXi or are you running the free version? PowerChute communicates to the host via RCLI and VMware disables RCLI in the free version of ESXi.

See Answer In Context

5 Replies 5
tj500_apc
Crewman
Crewman
0 Likes
0
233

Re: ESX 5.1 shutdown script on vMA

This was originally posted on APC forums on 5/31/2013


As an update, I tried adding chmod 777 to the ServerShutdown.sh document to see if that would help, but no luck.  Strange this is I had this thing working before I lost communications with the UPS as shown in my referenced article above.  So thinking that I may have done something weird to the config I recreated a test vma machine and tested it that way.  Still no luck.  Maybe there's some configuration I have to do on the ESX itself?  Just throwing out more ideas that may help clarify the situation.

tj500_apc
Crewman
Crewman
0 Likes
0
233

Re: ESX 5.1 shutdown script on vMA

This was originally posted on APC forums on 5/31/2013


Here's the output of my sshd_config file on the ESX

/etc/ssh # cat sshd_config

# running from inetd

# Port 2200

Protocol 2

HostKey /etc/ssh/ssh_host_rsa_key

HostKey /etc/ssh/ssh_host_dsa_key

UsePrivilegeSeparation no

SyslogFacility auth

LogLevel info

PermitRootLogin yes

PrintMotd yes

PrintLastLog no

TCPKeepAlive yes

X11Forwarding no

Ciphers aes128-ctr,aes192-ctr,aes256-ctr,3des-cbc

MACs hmac-sha1,hmac-sha1-96

UsePAM yes

# only use PAM challenge-response (keyboard-interactive)

PasswordAuthentication no

Banner /etc/issue

Subsystem sftp /usr/lib/vmware/openssh/bin/sftp-server

AuthorizedKeysFile /etc/ssh/keys-%u/authorized_keys

# Timeout value of 10 mins. The default value of ClientAliveCountMax is 3.

# Hence, we get a  3 * 200 = 600 seconds timeout if the client has been

# unresponsive.

ClientAliveInterval 200

BillP
Administrator Administrator
Administrator
0 Likes
0
234

Re: ESX 5.1 shutdown script on vMA

This reply was originally posted by Bill on APC forums on 5/31/2013


Why are you writing the script? PowerChute runs on the vMA and shuts down the host via RCLI. There is no need to script the shutdown yourself.

tj500_apc
Crewman
Crewman
0 Likes
0
234

Re: ESX 5.1 shutdown script on vMA

This was originally posted on APC forums on 5/31/2013


Bill, thank you for the reply.  Before I put on the script I tried unplugging the UPS to test the graceful shutdown and it did not work.  I can try again but are there any other settings I need to have?

BillP
Administrator Administrator
Administrator
0 Likes
0
234

Re: ESX 5.1 shutdown script on vMA

This reply was originally posted by Bill on APC forums on 6/3/2013


Did PowerChute record the loss of AC power in the event log? If it did then depending on your configuration the Host should have been notified to power down. Are you running a licensed version of ESXi or are you running the free version? PowerChute communicates to the host via RCLI and VMware disables RCLI in the free version of ESXi.