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.

17 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. Robert Perez on February 4th, 2012

    jumbo home loans, jumbo loan modification
    If you are a Jumbo home loan owner and couldn’t get a refinance because you were upside down, then you need to look at this opportunity using our finances an…
    http://www.youtube.com/watch?v=7Hi7suHgHCE
    jumbo loans, jumbo loan refinance

  8. Charles Jones on February 4th, 2012

    adjustable dumbbells
    Adjustable dumbbells new design makes them stronger and better made.
    http://www.dailymotion.com/video/xnubsk_selecttech-552_sport

  9. Sharon King on February 4th, 2012

    apple, mobile, iphone
    http://www.appswired.com/iphone-app-ideas/
    You donĂ¢??t have to be a genius to come up with extraordinary iPhone app ideas, find out about what are the top 7 app ideas that are making a killing in the App store.
    ipod, ipad

  10. Donald Green on February 4th, 2012

    adjustable dumbbells
    http://www.dailymotion.com/video/xnul32_stamina-versa-bell_tech
    Adjustable dumbbells save space and get rid of numerous sets of dumbbells.

  11. Brandon Smith on February 4th, 2012

    Childrens Furniture Beds
    http://www.furniture-collection.co.uk/furniture-by-style/childrens-furniture/childrens-beds.html
    Childrens Furniture Beds from Furniture Collection. Enjoy a no risk purchase with us, we offer a 100% Satisfaction Guarantee
    childrens beds

  12. Margaret Simmons on February 4th, 2012

    Best Blenders
    http://www.dailymotion.com/video/xo5lan_cuisinart-cbt-1000_lifestyle
    Best blinders Cuisinart PowerEdge/juicer/blender comes with a 64-ounce, 8-cup jar

  13. Joe Griffin on February 4th, 2012

    oral care, go smile, health
    http://www.whiteteethsolution.com/gosmile-whitening-system.html
    Read the review about GoSmile tooth whitening, a revolutionary one-step whitening system that gives you the whitest teeth you’ve always wanted with no mess, hassle, or discomfort.
    gosmile, teeth whitening

  14. Brian Collins on February 5th, 2012

    Polar heart rate monitor
    Polar heart rate monitor includes a feature, called the Polar Energy Pointer, that actually lets you know whether you’re making real progress or not.
    http://www.dailymotion.com/video/xo8p13_polar-heart-rate-monitor-reviews-polar-ft7_lifestyle

  15. Wayne Jones on February 5th, 2012

    Garmin Forerunner
    http://www.dailymotion.com/video/xo8oyz_garmin-forerunner-reviews-garmin-forerunner-405cx_lifestyle
    Garmin Forerunner with heart rate monitor where you can make the most of your training.

  16. David Smith on February 5th, 2012

    bed bug spray, sterifab, pest control
    http://www.getridofbedbugsathome.com/steri-fab-bed-bug-spray/
    Read the reviews, msds, ingredients of Steri-fab bed bug spray and how to apply this bed bug killer for best results.
    home, reviews

  17. Donald Reed on February 5th, 2012

    Pilates Chair
    http://www.dailymotion.com/video/xo9c52_malibu-pilates-chair-reviews-malibu-pilates-chair_sport
    Pilates Chair Malibu with 3 work out DVDs has created their own revolutionary version of the Pilates Chair. The Malibu Pilates Chair is a compact, sturdy and easy to use and comes with three workout DVD’s.

Leave a reply