Difference between revisions of "CyberPower UPS"

From ArchWiki
Jump to: navigation, search
(Install Procedure)
(9 intermediate revisions by one other user not shown)
Line 2: Line 2:
 
This document describes how to install the CyberPower UPS daemon. The main advantage of using a CyberPower UPS is that it is cheap and it can communicate with your Linux box through either a RS-232 or USB serial connection. In the event of a prolonged power outage, should the CyberPower UPS lose most of its battery capacity, it can tell the Linux box to perform a safe shutdown.
 
This document describes how to install the CyberPower UPS daemon. The main advantage of using a CyberPower UPS is that it is cheap and it can communicate with your Linux box through either a RS-232 or USB serial connection. In the event of a prolonged power outage, should the CyberPower UPS lose most of its battery capacity, it can tell the Linux box to perform a safe shutdown.
  
== Download and Extract the package ==
+
== Installation ==
  
Download the PowerPanel tar.gz package from here: http://www.cpsww.com.au/products/ups_systems/Value_soho/value600ei.htm
+
Install powerpanel from [[AUR]].
  
tar -zxvf ''package''
+
== Configuration ==
  
== Install Procedure ==
+
Edit {{ic|/etc/pwrstatd.conf}}
  
The latest PowerPanel version 1.2.3-0, only include support for rc.d, as such some manual intervention is needed.
+
Email notifications can be accomplished by editing {{ic|/etc/powerpanel/pwrstatd-powerfail.sh}} and {{ic|/etc/powerpanel/pwrstatd-lowbatt.sh}}
Using the included install.sh file as template, it needs to be modified for systemd so it should look like this:
+
{{Warning|Make sure the path to the email script at the bottom of these scripts is correct. It should be {{ic|/etc/powerpanel/pwrstatd-email.sh}}}}
  
In the following example, the lines of text are changed to support a USB style cable:
+
== Running ==
{{bc| vim install.sh|2=
+
#!/bin/sh
+
  
#
+
Start and enable the service
# The PowerPanel for Linux Software Installation
+
#
+
 
+
 
+
#
+
# copy files
+
#
+
 
+
# PowerPanel for Linux client program
+
/bin/cp bin/pwrstat /usr/sbin
+
 
+
# PowerPanel for Linux daemon program
+
/bin/cp bin/pwrstatd /usr/sbin
+
 
+
# Script command for event of power failure
+
if [ ! -e /etc/pwrstatd-powerfail.sh ]; then   
+
/bin/cp script/pwrstatd-powerfail.sh /etc
+
fi
+
 
+
# Script command for event of battery low
+
if [ ! -e /etc/pwrstatd-lowbatt.sh ]; then   
+
/bin/cp script/pwrstatd-lowbatt.sh /etc
+
fi
+
 
+
# Script command for e-mail notification
+
if [ ! -e /etc/pwrstatd-email.sh ]; then   
+
/bin/cp script/pwrstatd-email.sh /etc
+
fi
+
 
+
# PowerPanel for Linux daemon configuration
+
if [ ! -e /etc/pwrstatd.conf ]; then 
+
/bin/cp conf/pwrstatd.conf /etc
+
fi
+
 
+
# PowerPanel for Linux client man-page
+
if [ ! -e /usr/share/man/man8/pwrstat.8.gz ]; then 
+
/bin/cp doc/pwrstat.8 /usr/share/man/man8
+
fi
+
 
+
# PowerPanel for Linux daemon man-page
+
if [ ! -e /usr/share/man/man8/pwrstatd.8.gz ]; then 
+
/bin/cp doc/pwrstatd.8 /usr/share/man/man8
+
fi
+
 
+
#
+
# compress the man page file
+
#
+
 
+
if [ -e /usr/share/man/man8/pwrstat.8 ]; then
+
if [ -e /usr/bin/gzip ]; then
+
/usr/bin/gzip -9 /usr/share/man/man8/pwrstat.8
+
else
+
/bin/gzip -9 /usr/share/man/man8/pwrstat.8
+
fi
+
fi
+
 
+
if [ -e /usr/share/man/man8/pwrstatd.8 ]; then
+
if [ -e /usr/bin/gzip ]; then
+
/usr/bin/gzip -9 /usr/share/man/man8/pwrstatd.8
+
else
+
/bin/gzip -9 /usr/share/man/man8/pwrstatd.8
+
fi
+
fi
+
 
+
 
+
#
+
# Change the files owner
+
#
+
 
+
/bin/chown root:root /usr/sbin/pwrstat
+
/bin/chown root:root /usr/sbin/pwrstatd
+
/bin/chown root:root /etc/pwrstatd-powerfail.sh
+
/bin/chown root:root /etc/pwrstatd-lowbatt.sh
+
/bin/chown root:root /etc/pwrstatd-email.sh
+
/bin/chown root:root $STRATUP_DIR/$DAEMON
+
/bin/chown root:root /etc/pwrstatd.conf
+
/bin/chown root:root /usr/share/man/man8/pwrstat.8.gz
+
/bin/chown root:root /usr/share/man/man8/pwrstatd.8.gz
+
 
+
#
+
# Change the files mode
+
#
+
 
+
/bin/chmod 700 /usr/sbin/pwrstat
+
/bin/chmod 700 /usr/sbin/pwrstatd 
+
/bin/chmod 700 /etc/pwrstatd-powerfail.sh
+
/bin/chmod 700 /etc/pwrstatd-lowbatt.sh
+
/bin/chmod 700 /etc/pwrstatd-email.sh
+
/bin/chmod 700 $STRATUP_DIR/$DAEMON   
+
/bin/chmod 600 /etc/pwrstatd.conf
+
/bin/chmod 644 /usr/share/man/man8/pwrstat.8.gz
+
/bin/chmod 644 /usr/share/man/man8/pwrstatd.8.gz
+
 
+
}}
+
 
+
if you try and run /usr/bin/pwrstat you should get "Daemon service is not found." So you need to create a custom service as below
+
{{hc|
+
# vim /etc/systemd/system/pwrstatd.service|2=
+
[Unit]
+
Description&#61The PowerPanel Service for Linux to monitor CyberPower UPS
+
 
+
[Service]
+
Type&#61simple
+
ExecStart&#61/usr/sbin/pwrstatd
+
 
+
[Install]
+
WantedBy&#61multi-user.target
+
}}
+
 
+
Run the service
+
 
{{bc|
 
{{bc|
#systemctl start pwrstatd
+
# systemctl start pwrstatd
#systemctl enable pwrstatd
+
# systemctl enable pwrstatd
 
}}
 
}}
  
 
Then run  
 
Then run  
{{ic|#pwrstat -status}}
+
{{ic|# pwrstat -status}}
  
You should get something like this
+
You should get something like this:
 
{{bc|
 
{{bc|
  

Revision as of 16:20, 5 September 2013

This document describes how to install the CyberPower UPS daemon. The main advantage of using a CyberPower UPS is that it is cheap and it can communicate with your Linux box through either a RS-232 or USB serial connection. In the event of a prolonged power outage, should the CyberPower UPS lose most of its battery capacity, it can tell the Linux box to perform a safe shutdown.

Installation

Install powerpanel from AUR.

Configuration

Edit /etc/pwrstatd.conf

Email notifications can be accomplished by editing /etc/powerpanel/pwrstatd-powerfail.sh and /etc/powerpanel/pwrstatd-lowbatt.sh

Warning: Make sure the path to the email script at the bottom of these scripts is correct. It should be /etc/powerpanel/pwrstatd-email.sh

Running

Start and enable the service

# systemctl start pwrstatd
# systemctl enable pwrstatd

Then run # pwrstat -status

You should get something like this:


The UPS information shows as following:

        Properties:
                Model Name...................  Value 1500E
                Firmware Number.............. BFF7104#7N5
                Rating Voltage............... 230 V
                Rating Power................. 900 Watt
 
        Current UPS status:
                State........................ Normal
                Power Supply by.............. Utility Power
                Utility Voltage.............. 230 V
                Output Voltage............... 230 V
                Battery Capacity............. 100 %
                Remaining Runtime............ 61 min.
                Load......................... 126 Watt(14 %)
                Line Interaction............. None
                Test Result.................. Unknown
                Last Power Event............. None