APC UPS on OpenSolaris (apcupsd)

One of the best consumer UPS manufacturer on the market is APC. They make great products that can interface nicely with any UNIX-based system, whether it be Linux, BSD, or Solaris. Using their daemon (apcupsd), you can download the source and create a nice link-up with your UPS so you can be notified anytime your power goes out (or if you accidentally unplug it)

My home model is the APC ES550 which is USB-based and has a weird USB->RJ45 cable to link a computer with the UPS. Let me explain how to get this running with OpenSolaris with at least this model.

First you will need the latest apcupsd tarball located on Source Forge. Then, follow some standard compiling directions:

    $ tar zxvf apcupsd-3.14.4.tar.gz && cd apcupsd-3.14.4
    $ ./configure --enable-usb
    $ make
    # make install
If your model is USB-based, you need the enable-usb flag with the configure script. Now when you make, however, it will most likely fail with the following error.
libusb.h:9:34: /usr/sfw/include/usb.h: No such file or directory
... lots of errors ...

'make' fails on OpenSolaris because by default it is missing a usb.h header file located in /usr/sfw/include. This can be retrieved by running this command inside that directory as root.

    # wget http://src.opensolaris.org/source/raw/sfw/usr/src/lib/libusb/inc/usb.h
Binaries are stored inside /etc/opt/apcupsd/sbin.

The file apcupsd.conf is needed to configure this USB device. Two lines that say the following must be included in this file.

UPSCABLE usb
UPSTYPE usb
Delete any other UPSCABLE/UPSTYPE lines. The apcupsd.conf file documents other types of APC UPS devices as well, usually those that rely on serial as opposed to usb.

Now, you should be able to run the daemon and you can verify that it will notify you by simply pulling the plug on the UPS. If you modify your root alias in /etc/mail/aliases the UPS will send you an e-mail when the power goes out. This sounds handy if I'm campus and I lose the electricity in my apartment, so I'll have plenty of time to power off my machine remotely.

Comments:

Unless you have your cablemodem and router plugged into the UPS you'll likely not get into your system to do so.

apcupsd also has the ability to monitor the remaining power in the UPS and shut down your system automatically if the batteries go below a certain threshold.

Posted by Phillip Wagstrom on July 28, 2008 at 07:34 AM MDT #

Yep, you must have a modem and router both plugged in to survive an outage, but in the event of the power going out, my Internet connection stays afloat. apcupsd is a neat toy.

Posted by Paul Johnson on July 28, 2008 at 08:35 AM MDT #

1. For those running OpenSolaris Indiana, the required IPS packages for compiling apcupsd with USB support are: SUNWgcc SUNWgmake SUNWsfwhea. The last one gives you usb.h.

2. apcupsd-3.14.4 has a bug that causes 'make install' to fail on Solaris. This is fixed in the latest 3.14.x CVS branch, so presumably a future 3.14.5 or whatever would be fine. To download from cvs, install the SUNWcvs package, then use the following command to download it.
cvs -z3 -d:pserver:anonymous@apcupsd.cvs.sourceforge.net:/cvsroot/apcupsd co -d apcupsd-3.14-cvs -rBranch-3_14 apcupsd
Update it later by simply running 'cvs update' from inside the apcupsd-3.14-cvs directory.

3. Is anyone aware of an OpenSolaris binary package for apcupsd? If not, I might take it on. Any license or other issues would prevent this?

Posted by Mark on September 21, 2008 at 10:31 AM MDT #

I've been trying to get apcupsd running on an OpenSolaris release 2008.05 server as well. Dell hardware, using USB. Running the Device Driver Utility, I can see the UPS, but when I click on that line in the top, it has an Attach Status of Detached.

Rather new to OpenSolaris, though I run a number of Solaris 10 servers at my day job. Nerver did much with USB, though.

Tried compiling the normal tarball, manually copied stuff around. Might have missed something there, though. Tried the CVS release mentioned above, but it won't compile, dying at src/drivers/dumb/dumboper.c with a number of "'class UPSINFO' has no member" errors.

Thoughts on where to head next?

Posted by Joe Barbey on November 20, 2008 at 05:07 AM MST #

You might want to try rolling back to an older package and see if you have any better luck until the next version of the utility is released. This should list all downloads available for apcupsd. I believe the 3.14.3 version should work with 2008.5.

http://sourceforge.net/project/showfiles.php?group_id=54413&package_id=49059

Posted by Paul Johnson on November 20, 2008 at 05:39 AM MST #

Hi, great tutorial thanks for all the information. It installed fine on my opensolaris b101 but i can't run the deamon , is there a special command to do or normaly i would just run apcupsd in a shell?

Thanks
Sam

Posted by Samuel C on January 01, 2009 at 08:24 AM MST #

Finally got 3.14.3 running, though I needed to copy in the apc.h file from 3.14.4 to get it to compile. It kept complaining about FIONBIO not being defined.

I've now got apcupsd watching the USB UPS on solaris, and a windows 2000 server is monitoring the solaris box so it knows when utility power is gone as well.

Good to finally have this thing working right. Tomorrow I'll try the pulling the power to test. Thanks for your help everybody.

Posted by Joe Barbey on January 05, 2009 at 01:23 PM MST #

Hello. My config is somewhat different. I have SUI2200 attached to Win2008 server USB port but would still like to shut down OpenSolaris server when UPS goes down.

I tried installing pbe_agent_705_solaris-x86_jvm.bin as described on APC site but constantly getting:
Loading the installer...
Starting the installer...
Error: A class is missing from the classpath to run this program.
java.lang.NoClassDefFoundError
Unable to start the install wizard.
Is there a "java" command in the path that doesn't start the JRE?
If there is, remove it and try the installer again.

Java is installed, of course. Exporting DISPLAY as root from xterm didn't help either...

Posted by Tonci Grgin on January 14, 2009 at 01:46 AM MST #

I tried to run the apctest, after making sure my ups was connected and got: 2011-06-08 14:56:04 apctest 3.14.7 (1 August 2009) sun Checking configuration ... Attached to driver: usb sharenet.type = DISABLE cable.type = USB_CABLE You are using a USB cable type, so I'm entering USB test mode mode.type = USB_UPS Setting up the port ... apctest FATAL ERROR in generic-usb.c at line 636 Cannot find UPS device -- For a link to detailed USB trouble shooting information, please see <http://www.apcupsd.com/support.html>. apctest error termination completed Any ideas? I'm running it on a SUN Fire x4250 server. Roger

Posted by guest on June 08, 2011 at 06:13 AM MDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Hiya, my name is Paul Johnson and I'm a software engineer working on the ZFS storage appliance .

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today