This is a project similar to NUT project, but is much simpler/smaller and has more control (and simpler control, too) over the various things.
Currently it can monitor a single UPS attached to a given host, but network control is planned (since it's quite common to have single UPS for several hosts). It is also designed to support more than one UPS for a single host (think redundrand power supplies), but this functionality isn't implemented.
upsd is designed so that it is relatively easy to add support for other hardware.
It is trivial to write "event handler" using shell command language for example, and upsd package comes with a ready-to-use (on some systems anyway) example script.
In order to shut the system down properly, the scripts should be able to plug in to the very end of the shutdown process. The problem is that when the system is ready to turn the power off, it should notify UPS that it's safe to turn itself off too, or else UPS will continue to work and will discharge battery.
Even more, modern computers are able to turn themselves on when the input power restores (usually it's an option in BIOS). For servers which are running 24x7 for example, when we shut down due to lost power, it's essential to come back when the power restores - for this to work, UPS should turn itself off BEFORE the system will be switched off. But not all computers are 24x7 servers, and in certain cases there's no need to turn the computer back on after power returns.
On the other hand, in case of real user-triggered system shutdown, UPS monitoring software should turn the UPS off as well, without restoring everything when power returns (which not goes off in this case).
Another interesting point here is that modern operating systems are able to save all the state to disk and suspend all operations (hibernation). This can be used instead of shutdown if supported.
Note that upsd should trigger the UPS shutdown at the very last point of shutdown process, when all the processes has been terminated and all the filesystems has been unmounted. At this stage, there's no place where to save information about what exactly to do (allow system to be turned off before the UPS or UPS before the system; order UPS to turn back on when power returns etc). In case of hibernation, no external processes are invoked at all (it's done in the kernel), so there's no way to control the UPS.
Due to all this, real integration may turn out to be quite difficult and is definitely very system-specific. In many cases it is sufficient to just turn the system off and don't touch the UPS - when system is turned off, UPS battery isn't discharged that much, and the system is in a safe state. Sure that in this case there's no way to turn the system back on when the power returns (think of 24x7 servers), but it's still far better than to lose power and battery at an unexpected time and lose your data as a result. I know no other UPS monitoring package for Unix that does all the steps here, but basic steps are done by most of the available packages.
See this directory for actual software.
Please drop me a note if you have some information about hardware, some ideas, suggestions, patches, corrections and the like. Especially welcome is the information about whenever upsd works or not with a given hardware -- please collect as much information as possible.
Drop me a note if you think that it's worth the effort to set up a mailinglist for all this stuff.
Return to my software page.