Linux APC UPS with apcupsd
Scenario / Question:
How do I install apcupsd APC UPS software on my linux machine
Solution / Answer:
Obtain the apcupsd software from www.apcupsd.org and configure based on your type of APC UPS
Download apcupsd software:
The software can be found on sourceforge.com located here .
We will be using the RPM version.
Click on rpms – Stable and select the rpm package that matches your distro type. Download the rpm file to a directory of your choosing. For this tutorial I will be using directory /opt/apcupsd
Install needed packages / dependencies
The apcupsd needs a few other packages in order to install and run.
- lm_sensors
- net-snmp
- net-snmp-libs
Install the above packages using yum:
# yum install lm_sensors net-snmp net-snmp-libs
Install apcupsd software:
Install the apcupsd software using rpm:
# rpm -ivh apcupsd-xxxx.rpm
Configure apcupsd.conf
The configuration file for apcupsd is located /etc/apcupsd/apcupsd.conf. The configuration file is complex and discussing each option is beyond the scope this tutorial. For a complete reference to the configuration file visit the online documentation located at www.apcupsd.org .
Give your UPS a name by uncommenting (removing # character) for the value UPSNAME:
UPSNAME APC1000_Cabinet1
Define the type of cable that connects our UPS to our server. There are 4 options but the two most common are smart and usb but if you have a simple signaling or dumb UPS such as a BackUPS, you will need to know exactly what cable you have and specify the cable model number:
- smart — Serial Cable
- ether — Connected via network and not directly attached to UPS
- usb — USB Cable
- 940-0119A — Cable Model number for dumb UPS with cable 940-0119A
The APC UPS we are using is a APC 1000 SmartUPS so we will use “smart”
UPSCABLE smart
In addition to defining the UPS cable type we must also define the type of UPS that we have.
- apcsmart /dev/tty** — SmartUPS attached by Serial Cable ** is the port eg S0
- usb <BLANK> — USB UPS and enable autodetection for usb
- net hostname:port — Network link to a master apcupsd if UPS not directly connected
The APC UPS we are using is a APC 1000 SmartUPS using a Serial Cable on serial port 1. Defining Serial port numbers start at 0. The first serial port on your server will be defined as S0.
UPSTYPE apcsmart DEVICE /dev/ttyS0
Start apcupsd:
Red Hat systems start apcupsd:
# /etc/rc.d/init.d/apcupsd start or # service apcupsd start
Red Hat systems apcupsd start automatically when your system boots:
# chkconfig apcupsd on
Test apcupsd:
Process status. If you see something similar to the following output then ok. If not then check /var/log/messages.
# ps fax |grep apcupsd.conf 30299 ? Ssl 0:00 /sbin/apcupsd -f /etc/apcupsd/apcupsd.conf
Logging enabled. Using tail /var/log/messages you should see output that looks similar to the following:
# tail /var/log/messages Dec 10 03:02:07 server apcupsd[30299]: apcupsd 3.14.4 (18 May 2008) redhat startup succeeded
Apcaccess test. Check if apcupsd is properly updating its internal variables and communicating with UPS. You should get output similar to the following:
# apcaccess status APC : 001,049,1193 DATE : Wed Dec 10 03:12:23 PST 2008 HOSTNAME : localhost RELEASE : 3.14.4 VERSION : 3.14.4 (18 May 2008) redhat UPSNAME : APC1000_Cabinet1 CABLE : Custom Cable Smart MODEL : Smart-UPS SC 450 RM UPSMODE : Stand Alone STARTTIME: Wed Dec 10 03:01:54 PST 2008 STATUS : ONLINE LINEV : 117.3 Volts LOADPCT : 44.8 Percent Load Capacity BCHARGE : 100.0 Percent TIMELEFT : 27.0 Minutes MBATTCHG : 5 Percent MINTIMEL : 3 Minutes MAXTIME : 0 Seconds MAXLINEV : 118.0 Volts MINLINEV : 115.9 Volts OUTPUTV : 117.3 Volts SENSE : High DWAKE : 000 Seconds DSHUTD : 060 Seconds DLOWBATT : 02 Minutes LOTRANS : 106.0 Volts HITRANS : 127.0 Volts RETPCT : 000.0 Percent ALARMDEL : 5 seconds BATTV : 13.7 Volts LINEFREQ : 60.0 Hz LASTXFER : Automatic or explicit self test NUMXFERS : 0 TONBATT : 0 seconds CUMONBATT: 0 seconds XOFFBATT : N/A SELFTEST : NO STESTI : 336 STATFLAG : 0x07000008 Status Flag REG1 : 0x00 Register 1 REG2 : 0x00 Register 2 REG3 : 0x00 Register 3 MANDATE : 09/16/05 SERIALNO : QS0538223684 BATTDATE : 09/16/05 NOMOUTV : 115 Volts NOMBATTV : 12.0 Volts FIRMWARE : 736.a.D APCMODEL : DWD END APC : Wed Dec 10 03:13:01 PST 2008
Reboot on Power-Up:
In order to make sure that you server starts when power is restored after a power failure and shutdown, you must configure your servers BIOS setting “Restore on AC/Power” and set it to “Power On”



[...] Linux APC UPS with apcupsd [...]
send me tutorial stories in linux operating APC UPS especaily in ms word
Best regards