https://help.ubuntu.com/community/apcupsd
http://www.serenux.com/2011/01/howto-configure-an-apc-ups-to-communicate-with-your-ubuntu-desktop-or-server/
apt-get install apcupsd
Edit /etc/apcupsd/apcupsd.conf
To configure
- UPSNAME: a name
- UPSCABLE: how the UPS connects to the server
- UPSTYPE & DEVICE: see comments, corresponding to communication cable and communication parameters
- ONBATTERYDELAY: seconds before onbattery event triggered
- BATTERYLEVEL: percentage of power, below which to initiate shutdown
- MINUTES: when to start shutdown when remaining battery life less than xx minutes
- TIMEOUT: (in seconds) if UPS is smart, not recommended (use BATTERLEVEL and MINUTES); but good for testing
After configure:
- edit the file /etc/default/apcupsd and change the ISCONFIGURED no to ISCONFIGURED yes
- #sudo /etc/init.d/apcupsd start
- check status with #apcaccess status
- pull the power cable and test!
Customized Event Handling
For example, send an email notification upon power event, see:
http://www.apcupsd.com/manual/manual.html#customizing-event-handling