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”

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
Fabio Milano has written 79 articles for us. Fabio Milano is a certified RHCE, MCP, and CFOI. He runs an IT consulting and services company called RDS Support inc. Website:http://www.rdssupport.com
The information provided is for educational purposes only. All content including links and comments is provided "as is" with no warranty, expressed or implied. Use is at your own risk and you are solely responsible for what you do with it.

15 Comments so far

  1. [...] Linux APC UPS with apcupsd [...]

  2. kenneth on March 3rd, 2010

    send me tutorial stories in linux operating APC UPS especaily in ms word
    Best regards

  3. Rhinoplasty %0A on December 3rd, 2010

    you can always tell the quality of USB cables by looking at the thickness of the cable. thicker usb cables have higher quality :`’

  4. wanting your ex back on August 24th, 2011

    hello!,I like your writing so much! percentage we communicate more approximately your post on AOL? I need an expert on this space to unravel my problem. May be that is you! Having a look ahead to look you.

  5. Steve Swope on September 8th, 2011

    install on CentOS 5 running Dell OpenManage and Trixbox 2.6
    apcupsd fails to load with the following error.
    error while loading shared libraries: libnetsnmp.so.5: cannot open shared object file: No such file or directory.

    search reveals that there is already a newer version of the file libnetsnmp.so.10 in the /usr/lib/ directory that was installed by Dell OpenManage.

    Is there a way around this problem? Can apcupsd use the newer libnetsnmp.so.10 and if so how do I go about it?

    thanks in advance for your help.

    Steve

  6. Derek on October 9th, 2011

    Hey Steve,

    I think there is a far simpler method of installing apcupsd:
    1) Enable the EPEL repository for Centos5 (http://fedoraproject.org/wiki/EPEL) — “rpm -ihv http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
    2) “yum install apcupsd”

  7. Charles Williams on February 7th, 2012

    chicago, united states, houston, legal placement agencies, dc, florida, attorney placements, new york, in nyc
    http://www.bcgsearch.com/browsejob/pa-14/Tax-jobs.html
    Looking for Tax attorney jobs? Browse Tax attorney jobs by location like nyc, texas, ny, chicago, new york, california, dc, florida, nc, houston, michigan, united states on the best legal recruiters and legal placement agencies online BCG Attorney Search – The Standard in Attorney Search and Placement.
    ny, tax law jobs, michigan, texas, tax attorney jobs, legal recruiters, california, nc

  8. Daniel Roberts on February 7th, 2012

    interview tips, law firm interviewers
    http://www.bcgsearch.com/article/60732/Off-the-Record-Interview-Tips-from-Law-Firm-Interviewers/
    The most impressive interviewers are those who can clearly articulate why they are interested in our firm, with specific reasons that are based on research, Bcgsearch.com
    Bcgsearch.com, pre-interview preparation

  9. Patricia Griffin on February 7th, 2012

    art, school, college
    One of the fastest growing career fields these days is the field of computer animation. Skilled animators produce entertaining products.
    http://ezinearticles.com/?A-Career-in-Computer-Animation-Will-Fill-Your-Pockets—Must-Read&id=4306102
    careers, animation

  10. Philip Perez on February 8th, 2012

    insurance quotes, business liability insurance, insurance
    http://www.cageneralliability.com/
    California General Liability Insurance Brief, insurance quotes and rates comparison
    commecial liability insurance, liability insurance, general liability insurance

  11. Stephanie Hernandez on February 9th, 2012

    Zeitarbeit, Jobs, Arbeiten
    Zeitarbeit Gera aktuelle Stellenangebote in Gera und Umgebung sowie aktuelle Karrieretipps zum Arbeiten
    http://www.zeitarbeit-gera.com/
    Gera, Stellenangebote, Verdienen

  12. Debra Davis on February 9th, 2012

    teeth whitening
    Teeth whitening has become more popular in recent years, to the point where it is now an ultra-competitive marketplace. Check out our teeth whitening reviews and recommended teeth whitening products.
    http://www.smilebrightertoday.com/

  13. Jose Price on February 9th, 2012

    procera, cognitive enhancer
    http://astore.amazon.com/proceraproceraavh-20/detail/B0026QY3KO
    Procera contains a proprietary blend of safe, natural and effective
    ingredients that have been clinically shown to help reduce stress related
    conditions, e.g., anxiety, depression and sleep loss, as well as improve
    memory and recall speed, focus and concentration, mental clarity and even IQ.
    boosts memory, mental allertness

  14. Gregory Smith on February 9th, 2012

    joint supplements for dogs
    http://www.glucosaminepillsfordogs.com/category/dog-glucosamine/winston/
    Our specially formulated pain reliever is the strongest, most powerful, natural pain relief product on the market today.

  15. Cheryl Davis on February 9th, 2012

    BCG Attorney Search
    Not being from the area, your insight and knowledge of the local market was a tremendous help.
    http://bcg-attorney-search.incprofile.com

Leave a reply