While the current Smart-UPS (aka SMT) range of UPS from APC has much fewer variables exposed in a way that is useful for fancy apcupsd usage (you’ll find apcupsd in EPEL), they are still amply sufficient for home use. Basically, the UPS gives an estimated time left at current load and the remaining battery level. At home these are anyway the only two readings I want to trigger scripts on.
On the machine that has a USB connection to the UPS
Connect the UPS via USB to your server. Then install apcupsd
/etc/apcupsd/apcupsd.conf. I changed the following from defaults to be a bit more conservative;
Be sure to set an email address you read often in the scripts that are run on events (e.g.:
/etc/apcupsd/onbattery ), ideally using an email to SMS gateway. For USB based SMT series, no further changes are necessary as that type of connection is the default.
For the next step to work, you’ll want to allow access to the daemon through the local firewall. Something along the lines of
Or use system-config-firewall to allow 3551 TCP.
On machines that get power from the same UPS and can reach the main box over the network
Install and configure
/etc/apcupsd/apcupsd.conf as before, but this time point it at a machine called server. Additionally, I shut down most of these boxes earlier.
1 2 3 4
And you may want to take more drastic action in the
/etc/acpupsd/commfailure script if you want to react to network outages.
All the other options are sane if all you want is your machines to shut down cleanly before the UPS runs fully out of juice.
Unimportant things (e.g. the WLAN AP) get plugged into the secondary ports (caveat the SMT750I does not have these) and the behaviour of these ports configured on the UPS front panel.
Mind bug 661304, as RHEL5 is still using SysV init, my
/etc/init.d/halt reads near the bottom:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21