User Tools

Site Tools


computing:linux:ups:cyberpower

This is an old revision of the document!


Configure CyberPower UPS Monitoring on Linux

CyberPower PowerPanel for Linux

:!: PowerPanel e-mail alerts use the mail command. This will not work on XenServer and many other boxes, at least not without additional tweaking. Don't enable mail alerts without first dealing with the mail command.

See also: Postfix Authenticated Smarthost

See also: SSMTP

Installation

Connect the included USB cable to UPS. You may have problems getting it to work with the serial cable.

RPM

:!: Tested with SME Server 8 and a CyberPower CP900AVR UPS.

rpm -Uvh http://www.cyberpowersystems.com/software/powerpanel_123_i386.rpm

Tar

:!: Tested with SME Server 7.3 and a CyberPower CP1500AVRT UPS.

Download the PowerPanel software to the machine where the UPS is connected:

wget http://www.cyberpowersystems.com/software/powerpanel_1.2_i386.tar.gz

Unpack and install:

tar -xzvf powerpanel-1.1.tar.gz
cd powerpanel-1.1
./install.sh

Check Communications

pwrstat -status
pwrstat -config

Verify startup:

chkconfig --list |grep pwr

For SME Server only which uses runlevel 7:

ln -s /etc/rc.d/init.d/pwrstatd /etc/rc7.d/S93pwrstatd

Configuration

We don't want the server to shut down immediately upon power failure…we want to wait until the battery gets low before we actually run the shutdown command.

Edit the PowerPanel configuration file:

vi /etc/pwrstatd.conf

And change:

powerfail-shutdown = no    #we want to shut down the UPS when the battery gets low, not when the power fails
shutdown-sustain = 200     #set this to a little longer than it takes to shut your server down
lowbatt-threshold = 15     #don't run the battery completely dead

Restart the service:

/etc/init.d/pwrstatd restart

or

service pwrstatd restart

Commands that run upon power-fail and low-battery events are also specified in the /etc/pwrstatd.conf configuration file. By default, it specifies:

/etc/pwrstatd-powerfail.sh

and

/etc/pwrstatd-lowbatt.sh

Testing

You may want to change the lowbatt-threshold to 90 so the box shuts down in the shortest time, then change it back when finished testing.

lowbatt-threshold = 90

service pwrstatd restart

tail -f /var/log/pwrstatd.log

XenServer

:!: These settings are probably not ideal, but are a good start. I think the goal would be to confirm that all VMs are shut nown properly before issuing the shutdown command.

Modifications to above for XenServer:

vi /etc/pwrstatd.conf

And change:

powerfail-shutdown = no    #we want to shut down the UPS when the battery gets low, not when the power fails
shutdown-sustain = 600     #set this to a little longer than it takes to shut down all VMs and your server
lowbatt-threshold = 35     #don't run the battery completely dead and give time to shut down
lowbatt-duration = 60      #allow the script to run for 60 seconds before the shutdown
vi /etc/pwrstatd-lowbatt.sh

and append:

xe vm-shutdown power-state=running --multiple
computing/linux/ups/cyberpower.1638810399.txt.gz · Last modified: 2021/12/06 10:06 by gcooper