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

TUTORIAL: APC UPS management with apcupsd (addendum)

by Andrew Newman (UPDATED: 2004-03-14)

I have now tried this with my old APC Back-UPS Office 350 va at home. Though the battery doesn't hold much of a charge anymore and there isn't much information that one can gain from the 'dumb' serial cable. It can still be useful for a rapid shutdown if power is out for, say, more than 1 minute.

Installation: follow original tutorial.
Attaching UPS: Please follow all warnings and disclaimers in the original tutorial.

With that said, it should not be much more difficult than:
1) powering down your computer and accessories;
2) plugging in your UPS to a wall outlet;
3) deciding which power should be on battery back-up (I chose my CPU only--old battery) and plugging it into the uninteruptable outlets on the UPS;
4) plugging the rest of the equipment into the surge-only (protected) outlets on the UPS (if available);
5) Go ahead and plug in the serial and funky "phone-jack" connections into the computer's serial port and UPS's comm port, respectively.
6) Turn on the UPS, and then boot up your computer and log-in.

Detection:

Since this is a 'dumb' serial connection, do not expect to see any information come up in /var/log/messages.
Instead, you are going to have to check /proc/tty/driver/serial for the serial port that the UPS comm is connected to (as root):

% cat /proc/tty/driver/serial
serinfo:1.0 driver:5.05c revision:2001-07-08
0: uart:16550A port:3F8 irq:4 baud:2400 tx:0 rx:0 RTS
4: uart:16550A port:D800 irq:3 tx:0 rx:0 CTS|DSR

The second line of output tells me there is a very slow baud:2400 connection at comm 0. This is my UPS connection (my win-modem is at comm 4; third line). The comm port information is important for the next step -- configuration.

Configuration:

Once again, the configuration file, /etc/apcupsd/apcupsd.com, is full of many comments to help guide you through your particular setup. I will only list here the changes necessary for my 'dumb' UPS.

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

UPSCABLE 940-0119A   # cable name on serial connector
UPSTYPE dumb    # I told you it was a 'dumb' connection
DEVICE /dev/ttyS0 # the '0' is from the comm port, described above.
TIMEOUT 60 	 # I have the machine power-down after only 60 seconds 
# because this battery is not very good anymore.  You, would certainly want to go longer if you can.

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,019,0512
DATE     : Sun Mar 14 09:04:19 MST 2004
HOSTNAME : basilisk.home.net
RELEASE  : 3.10.11
VERSION  : 3.10.11 (26 January 2004) mandrake
UPSNAME  : basilisk.home.net
CABLE    : APC Cable 940-0119A
MODEL    : DUMB UPS Driver
UPSMODE  : Stand Alone
STARTTIME: Sat Mar 13 09:09:54 MST 2004
STATUS   : ONLINE 
MBATTCHG : 15 Percent
MINTIMEL : 5 Minutes
MAXTIME  : 60 Seconds
NUMXFERS : 0
TONBATT  : 0 seconds
CUMONBATT: 0 seconds
XOFFBATT : N/A
STATFLAG : 0x02000008 Status Flag
END APC  : Sun Mar 14 09:04:19 MST 2004

This doesn't tell me much, but it does tell me that I am currently online, STATUS : ONLINE, and if I were on battery it would tell me how long, TONBATT : 0 seconds.

Final Notes:

Please see the notes at the end of the original article.


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