Google Site SearchFN Site Search FN Blog Login FN Blog Login
Site Navigation:
 
 

TUTORIAL: APC UPS management with apcupsd (page 3)

by Andrew Newman

Configuration:

As long as you have installed a recent version of apcupsd, the configuration should be rather simple.
The first thing to do is to make certain that the configuration file /etc/apcupsd/apcupsd.conf has the correct information. The file is complete with many, many comments to help guide you through your particular setup. I will only list here the changes necessary for my UPS (or any other that uses a USB to interface).

Using your favorite editor make certain the following parameters are set in /etc/apcupsd/apcupsd.conf

UPSCABLE usb   # assuming you are connected via usb
UPSTYPE usb    # still assuming you are connected via usb
DEVICE /dev/usb/hiddev[0-15] # be certain it is typed exactly as shown here for fedora
MINUTES 5 	 # the default of only 3 minutes available on battery power was too close for me

If you are now comfortable with your changes, it is time to start up the system and run a check of the UPS.

Running apcupsd:

Your apcupsd daemon may have already tried to start if you rebooted your machine after installation (as in these instructions). Just in case, lets go ahead and use the daemon restart command as it will not hurt if the daemon is currently dead:

% /etc/rc.d/init.d/apcupsd restart
Shutting down UPS monitoring:                              [FAILED]
Starting UPS monitoring:                                   [  OK  ]

Now the daemon should be running fine. Lets go ahead now and check to see what the current status of our battery is by running the following command:

% apcaccess
APC      : 001,034,0851
DATE     : Tue Mar 09 19:08:01 MST 2004
HOSTNAME : machine.subnet.net
RELEASE  : 3.10.11
VERSION  : 3.10.11 (26 January 2004) redhat
UPSNAME  : machine.subnet.net
CABLE    : USB Cable
MODEL    : Back-UPS RS 1500
UPSMODE  : Stand Alone
STARTTIME: Tue Mar 09 19:04:42 MST 2004
STATUS   : ONLINE
LINEV    : 118.0 Volts
LOADPCT  :  22.0 Percent Load Capacity
BCHARGE  : 100.0 Percent
TIMELEFT :  40.6 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 5 Minutes
MAXTIME  : 0 Seconds
LOTRANS  : 097.0 Volts
HITRANS  : 132.0 Volts
ALARMDEL : Always
BATTV    : 26.8 Volts
NUMXFERS : 0
TONBATT  : 0 seconds
CUMONBATT: 0 seconds
XOFFBATT : N/A
SELFTEST : NO
STATFLAG : 0x02000008 Status Flag
MANDATE  : 2003-11-25
SERIALNO : JB0348013623
BATTDATE : 2001-09-25
NOMBATTV :  24.0
FIRMWARE : .g8 .D USB FW:g8
APCMODEL : Back-UPS RS 1500
END APC  : Tue Mar 09 19:08:15 MST 2004 

Great! The UPS is at 100% charge, I am only using 22% of the load capacity and if the power were to go out right now, I should be able to work for roughly 40 minutes (with my LCD screen powered by the UPS too) before coming to a screeching halt. However, the program will send very annoying wall messages at 5 minute intervals telling me to log off, before it will auto powerdown my machine when the battery power becomes critical.

This certainly is not an exhaustive tutorial of all the bells and whistles associated with this program, as there are many many features that I have never utilized nor are appropriate for my hardware. Thus, I will direct you to the docs that should now be installed on your machine (came with the daemon rpm) at file:/usr/share/doc/apcupsd-3.10.11/docbook/manual.html .

I would suggest going through this manual and trying some of the physical tests described.

One Last Note:

This is totally dependent on how you want your machine to react when it is forced to shut down.
You may want to change your bios so your computer will go to LAST_STATE if power is returned to it. Also, you may consider removing the -p option in the second-to-last line of /etc/rc.d/init.d/halt in order to allow your machine to auto-reboot when power comes on, otherwise the -p option turns the machine completely off.
See the commented-out line below:

#[ -f /poweroff -o ! -f /halt ] && HALTARGS="$HALTARGS -p" 
 [ -f /poweroff -o ! -f /halt ] && HALTARGS="$HALTARGS"

exec $command $HALTARGS

I hope this TUTORIAL brings you many uninteruptable hours of work or play!


Please email me if you found this useful, or have any comments or suggestions!