Network UPS Tools is a useful package for controlling UPSes with Linux servers – I recently moved to this package from apcupsd since it offers better integration with RHEL-style distributions.
Unfortunately the packages aren’t shipped with CentOS, so I’ve created some packages for it which can be downloaded from the Amberdms public repositories.
Most of the setup is pretty straightforwards (follow along with the online help) but the one issue that had me stuck was setting the time until shutdown, which would default to only two minutes – hardly enough for systems such as virtual machine servers.
Turns out this can only be adjusted by changing the settings on the UPS itself – in my case I was using an APC UPS.
You can get a listing with:
$ upsc YOURUPS
To change the timer (at least on APC BackUPS) you should run:
$ upsrw -u admin -p PASSWORD -s battery.runtime.low=SECONDS YOURUPS@localhost
The notes I read suggested that this should remain in the UPS settings, but in testing I found the value was reset – I suggest including the command in /etc/rc.local to ensure it gets run every boot time.