APC PowerChute

最後更新: 2021-03-19

介紹

PowerChute 有分 Personal 版及 Business 版:

  • Business 版: Smart-UPS, Web Program
  • Personal 版: Back-UPS, Window Program

使用時要安裝正確的 Driver

 


Software - APC PowerChute Business Edition - v9.5

 

HomePage: http://www.apc.com

For ESXi platforms, PowerChute must be installed on the vMA(vSphere Management Assistant)

running on the ESXi server and cannot be installed directly on the host operating system.

--

vMA is a prepackaged Linux virtual machine in which administrators can deploy scripts and

select third-party agents to manage ESX and ESXi systems.

Software included in vMA includes

  • vSphere CLI
  • an authentication component that supports non-interactive login
  • DCLI commands

https://code.vmware.com/web/tool/6.5/vma

--

At first glance it appears that you need a vMA instance installed on the VMware box. 

Then, using Linux commands, install and configure PowerChute Business Edition on the vMA. 

This will then allow you to connect to the UPS and shutdown the VMs gracefully.

Download:

APC Smart-UPS C 1500VA LCD 230V (APC UPS SMC1500I)

https://www.apc.com/shop/iq/en/products//P-SFPCBE95

PowerChute Business Edition

  •  bundled JRE 1.8
  •  SNMP is enabled by default

 


人手建立 VM Install PowerChute (Centos)

 

Install

rpm -Uvh pbeagent-9.2.0-604.i386.rpm

/opt/APC/PowerChuteBusinessEdition/Agent/config.sh

答一些問題

New Username
New Password
Cable Type:
Are the UPS settings correct?
Start PowerChute Business Edition Agent?

chkconfig PBEAgent on

在 Firewall 開 port

# UPS
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6547 -j ACCEPT

/etc/init.d/PBEAgent start

Usage

入到 web panel 再設定 UPS, Default 要 https

web panel

 


ESXi Host Agent VM Setting

 

1. In the vSphere client, select the ESXi host and click on the Configuration tab.

2. Select Virtual Machine Startup/Shutdown and click Properties.

3. Enable the option "Allow virtual machines to start and stop automatically with the system"

4. Select "Guest Shutdown" as the Shutdown action from the drop down list.

 


Reset Panel Password(Windows)

 

# V9.5 on Win10

[1] 建立 pcbeConfig.ini

到 C:\Program Files (x86)\APC\PowerChute Business Edition\agent

建立 pcbeConfig.ini

[Credentials]
username=
password=

- The username must be between 6 and 128 characters in length.
- The password requires:

• Minimum 8 and maximum 128 characters in length
• 1 upper and lower case letter
• 1 number or special character
• The username cannot be part of the password.

[2] Restart the APC PBE Agent service

 


Windows Run Script

 

PowerChute Business Edition Version 9.5

1.

Log in to the PowerChute UI and navigate to the "Shutdown/Shutdown Settings" screen.

Under "Operating System and Application Shutdown", select the "default.cmd" file.

Provide an appropriate delay (minimum 10 seconds) to run the command file.

"Time for operating system to shut down" => Outlet Group "?" powering the PowerChute Agent turns off

2.

3.

修改 C:\Program Files (x86)\APC\PowerChute Business Edition\agent\cmdfiles 下的 default.cmd

C:\apc\shutdown.bat

C:\apc\shutdown.bat

rem for debug
rem echo %date% %time% > C:\apc\log.txt
rem start "" "C:\Windows\System32\ping.exe" -n 2 192.168.88.150

@start "" "C:\apc\psshutdown.exe" /AcceptEULA -u MyUsr -p MyPW -t 0 -r \\192.168.88.122

exit

必須要 exit 尾, 否則 cmd.exe 會愈來愈多

Event Log

3/22/21    14:31:19    Monitoring Stopped
3/22/21    14:31:19    Unswitched Group commanded to: shutdown using delay
3/22/21    14:31:19    Shutdown process started
3/22/21    14:31:19    Time On Battery Threshold Exceeded
3/22/21    14:30:17    On Battery
...

不正常關機的 Window event log: 6008

 


Script to shutdown remote ESXi(Linux)

 

/opt/APC/PowerChuteBusinessEdition/Agent/cmdfiles/default.sh

#!/bin/bash

log_file=/var/log/doshutdown.log

# Avoid wrong to shutdown Server
echo "This script will shutdown Server after 30 sec."
sleep 30

# Remote Shutdown
echo `date` &>> $log_file

# 1
server_ip=192.168.1.190
pw_file=/etc/apcupsd/pw/centos7.key
sshpass -f$pw_file ssh -l root $server_ip poweroff &>> $log_file

# Shutdown local
#shutdown -h now

# Done

echo "Done"

何時 run script

* At runtime limit

* After the UPS has been battery for

 


更換 UPS

 

The communication port is no longer configurable within the Agent in v9.5+.

If you wish to change from a USB port to a serial port, you must re-install the PowerChute Business Edition Agent.

 


 

 

Creative Commons license icon Creative Commons license icon