Powercadd Powerchute Network Shutdown V4.1

When using the APC PowerChute software you can (must) run a script to shutdown your servers before battery is too low.
On the PowerChute web page, select the events you want to run a script from.
Add the default.cmd (C:Program FilesAPCPowerChute Business Editionagentcmdfilesdefault.cmd) command file.

PowerChute Network Shutdown v4.1 - Operating System, Processor, JRE & Browser Compatibility Chart. PowerChute Network Shutdown v4.3 (64-bit systems only) p This software only supports English language.Please carefully read the End User License Agreement (“EULA”) available above as it governs your use of this software.


The default.cmd contains after a fresh install :
@echo off
rem
rem Maximize for best viewing
rem This command file provides examples of proper command file syntaxV4.1
rem
rem Command Files run by PowerChute Business Edition must be placed in this directory.
rem
rem Use the full path name of executable programs and external command files.
rem
rem The @START command must be used to run executable programs (see example below).
rem For the @START command, path names that include spaces must be enclosed in quotes;
rem arguments for the executable must be outside the quotes. A double quote must
rem precede the quoted path name. For example, to execute a command file in
rem c:Program FilesAPCPowerChute Business Editionagentcmdfiles called myShut.exe,
rem the following line should be entered in the command file:
rem
rem @START ' 'c:Program FilesAPCPowerChute Business EditionagentcmdfilesmyShut.exe'
rem
@echo on
Add some new commands at the end like :
@START ' 'C:WINDOWSsystem32shutdown.exe' /s /f /m myserver.mydomain.intra /c 'APC Shutdown' /d 6:12
This will shutdown your server remotely, closing all open applications and with a warning message.
You can add other commands or batch too.

Powercadd Powerchute Network Shutdown V4.1 Update

IMPORTANT : the powerchute agent service may not run with sufficiant privilieges, so it cannot execute a shutdown on a remote server. Usually it uses a local account.
You need to change it to use an AD admin account :
http://community.spiceworks.com/how_to/55064-how-to-gracefully-shut-down-vsphere-5-x-esxi-free-using-an-eaton-ups-with-ipm-and-the-command-line
NOTE:
-I use APC PCNS for Linux only. I didn’t use its PCNS because I don’t have APC UPS with NMC.
If I have NMC, I’ll use PCNS instead of apcupsd or still using apcupsd with pcnet settings
If someone want to donate me APC NMC, I’ll glad to test for them

-login as root to pcns and install apcupsd

# yum -y install apcupsd
-for linux based apt-get use these commands
# apt-get putty-tools

# yum -y install openssh-clients

-test ssh using admin account

install pexpect using either these commands
or
# apt-get install python-pexpect

# cat /root/shutcucm.py

import sys
server_user = “<platform user>”
child = pexpect.spawn(‘ssh %s@%s’ % (server_user, server_ip))
child.timeout = 60
child.sendline(server_pass)
child.sendline(‘utils system shutdown’)
child.sendline(‘yes’)
child.expect(‘ Appliance is being Powered – Off …’)
print ‘Shutdown command successfully sent.’

-connect usb cable from pc to esxi

# cat /etc/apcupsd/apccontrol

prefix=/usr
APCPID=/var/run/apcupsd.pid
SHUTDOWN=/sbin/shutdown
SCRIPTDIR=/etc/apcupsd
if [ -f ${SCRIPTDIR}/${1} -a -x ${SCRIPTDIR}/${1} ]
${SCRIPTDIR}/${1} ${2} ${3} ${4}
# exit code 99 means he does not want us to do default action
exit 0
fi
killpower)
echo “Apccontrol doing: ${APCUPSD} –killpower on UPS ${2}” | ${WALL}
${APCUPSD} –killpower
echo “Apccontrol has done: ${APCUPSD} –killpower on UPS ${2}” | ${WALL}
commfailure)
echo “Warning communications lost with UPS ${2}” | ${WALL}
commok)
echo “Communications restored with UPS ${2}” | ${WALL}
powerout)
onbattery)
echo “Power failure on UPS ${2}. Running on batteries.” | ${WALL}
offbattery)
;;
if [ -f /etc/apcupsd/powerfail ] ; then
fi
failing)
echo “Battery power exhaused on UPS ${2}. Doing shutdown.” | ${WALL}
timeout)
echo “Battery time limit exceeded on UPS ${2}. Doing shutdown.” | ${WALL}
loadlimit)
echo “Remaining battery charge below limit on UPS ${2}. Doing shutdown.” | ${WALL}
runlimit)
echo “Remaining battery runtime below limit on UPS ${2}. Doing shutdown.” | ${WALL}

Powercadd Powerchute Network Shutdown V4.1 Download

doreboot)
echo “UPS ${2} initiating Reboot Sequence” | ${WALL}
${SHUTDOWN} -r now “apcupsd UPS ${2} initiated reboot”
doshutdown)
echo “UPS ${2} initiated Shutdown Sequence” | ${WALL}

Powercadd Powerchute Network Shutdown V4.1 Mac

${SHUTDOWN} -h now “apcupsd UPS ${2} initiated shutdown”
echo “****** Executing ESXi Shutdown Command ******” | ${WALL}
plink -ssh -2 -pw password root@10.0.100.200 “/sbin/shutdown.sh && /sbin/poweroff”
annoyme)
echo “Power problems with UPS ${2}. Please logoff.” | ${WALL}

Powerchute Network Shutdown Download

emergency)
echo “Emergency Shutdown. Possible battery failure on UPS ${2}.” | ${WALL}
changeme)
echo “Emergency! Batteries have failed on UPS ${2}. Change them NOW” | ${WALL}
remotedown)
echo “Remote Shutdown. Beginning Shutdown Sequence.” | ${WALL}
startselftest)
endselftest)
battdetach)
battattach)
*) echo “Usage: ${0##*/} command”
echo ” warning: this script is intended to be launched by”

Powercadd Powerchute Network Shutdown V4.1 Password

echo ” apcupsd and should never be launched by users.”

Powercadd Powerchute Network Shutdown V4.1 Code

;;