# APC UPS and Gentoo

## Akaihiryuu

I recently got an APC UPS to use for my new server.  It's not a real high end one ($42 at Micro Center)...basically the cheapest model that has a PC connection.  It connects via USB to the PC.  Unfortunately I have no way to test it right now, as I'm using a very old server that has no USB (AT keyboard too, but I built it out of spare parts 3 years ago).  I'm planning on building a new one with a mini-ITX motherboard, and I will be hooking the UPS to it once I do that...well the USB anyway, the power is already connected.  I've heard that APC UPS's work well with Linux...I'm just wondering if anyone has gotten the PC functionality to work with Gentoo.  I'd like to be able to have it issue a shutdown when the battery gets low so the server gets cleanly shut down during a power outage.  I don't need extended uptime during an outage, as my other computers don't have UPS's.  I figure the UPS should be good for 10-15 minutes once the power is out (since it's also powering the cable modem and switch).

----------

## sandcrawler

We mainly use Belkin UPSs on our pc's at work and they were great enough to include *nix monitoring software with them.  It works really well and scripted commands are easy to use.   They also work in either USB or serial mode.  

With that said, we've used APC ups's before and they shouldn't be much more difficult than installing apcupsd (sys-power/apcupsd) and configuring that.

According to the documetation it works with USB ups's so long as you use the latest release, 3.10.18, I think.  Portage has it  :Smile: 

take care

----------

## Incabulos

I have never investigated the APC software under windows, but apcupsd http://www.apcupsd.com/ works a charm as the previous poster has said, I use it under BSD and it would be just as good under Linux. The hardest part of my setup was figuring out what type of cable it used and adding the appropriate entry to apcupsd.conf ( what I thought was a regular serial cable is apparently a 940-0095A, go figure ).

Online graphing and status reporting of the UPS is nice, it works via some simple php scripts and CSS files, and it works under a chrooted' apache setup just fine. You can script staged shutdowns, email notifications, etc of power losses easily, it all Just Works (TM)

----------

## Drunkula

I have a fairly cheap USB connected APC.  Using apcupsd works fine for me.  I haven't tried any of it's more advanced features (network monitoring, control) so I can't speak about those.  But the basic features just work as intended.

----------

## Akaihiryuu

Wow, that was easy as can be.  emerge apcupsd, edit apcupsd.conf, start it, plug USB cable in, done.  It's working great now.  I think it will even try to email me if there's a UPS event (hence it requiring ssmtp).

----------

## Kai Hvatum

I have a large APC UPS and use the network shutdown abilities and it's worked every time without fail. Fifteen powerfailures this summer but no hardware shutdowns.

----------

## blixel

 *Akaihiryuu wrote:*   

> Wow, that was easy as can be.  emerge apcupsd, edit apcupsd.conf, start it, plug USB cable in, done.  It's working great now.  I think it will even try to email me if there's a UPS event (hence it requiring ssmtp).

 

Does the APC UPS require any particular kernel module(s)?  I replaced my old APC UPS today with a new, more powerful one.  I decided to check out the USB cable option and emerge apcupsd.  But when I run apctest, I just get this:

```
2005-10-23 21:59:28 apctest 3.10.18 (21 July 2005) gentoo

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 linux-usb.c at line 597

Cannot find UPS device --

For a link to detailed USB trouble shooting information,

please see <http://www.apcupsd.com/support.html>.

apctest FATAL ERROR in linux-usb.c at line 597

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
```

----------

## mwilliamson

There a guide in the Gentoo Wiki for using apcupsd. I suggest you look at it. I followed it and it works great. The UPS works well and there is web based monitoring for it.

----------

## tlailax

using a usb connected apc and a serial connected apc with nut (network ups tools). the usb driver only has the battery level monitoring stuff (at least last time i checked) the serial driver has lots more options. works nicely.

----------

## Akaihiryuu

apctest for me gave weird errors too...but the log file for apcupsd tells me that everything is fine.

triforce akai # apctest

2005-10-24 23:56:02 apctest 3.10.18 (21 July 2005) gentoo

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 apcdevice.c at line 77

Unable to create UPS lock file.

apctest FATAL ERROR in apcdevice.c at line 77

Unable to create UPS lock file.

apctest error termination completed

From /var/log/apcupsd.events:

Fri Oct 07 02:01:39 EDT 2005  apcupsd 3.10.18 (21 July 2005) gentoo startup succeeded

Wed Oct 12 09:23:50 EDT 2005  Power failure.

Wed Oct 12 09:23:54 EDT 2005  Power is back. UPS running on mains.

Wed Oct 19 11:25:42 EDT 2005  Power failure.

Wed Oct 19 11:25:45 EDT 2005  Power is back. UPS running on mains.

Sat Oct 22 01:37:11 EDT 2005  Power failure.

Sat Oct 22 01:37:13 EDT 2005  Power is back. UPS running on mains.

Maybe apctest just has issues?

----------

