I have now installed and configured sysutils/nut on FreeBSD. It's a UPS management package.
It took some effort, but was worthwhile, as I got exactly what I wanted in the end.
Some of the sentiment I tripped across while doing the research was that sysutils/apcupsd (which does a similar function) was easier to set up -- but the ports description says it's only for APC UPS models. I got the feeling that APC UPS models were well regarded (and frequently emulated).
I have a CyberPower CP1500EPFCLCD.
The documentation for nut was above average with a user manual in both online and PDF formats, plus there was an excellent set of Configuration Examples.
I initially installed it with everything in default configuration. This worked, shutting down the server when the UPS battery got low. But I wanted the shutdown to occur three minutes after the wall power failed. There was good documentation on how to do this (its called a "timed shutdown"), but you the need to study the examples and write a number of custom scripts to get the job done.
I also had a fully functional network shutdown strategy in place, using one-shot ssh(1) commands, so I chose to set nut up using a single UPS controlling a single server (my ZFS server). When it comes time to perform the final shutdown of the ZFS server after a power failure (through nut), I just reach out using ssh to shut down all the other hosts that share the UPS. [This meant that I did not need a nut client on every host on the network, and works well in a home office context -- where I am the only user to placate.]
It took a few days to get it all running perfectly, and right near the end I tripped across a nut/CyberPower problem. It took a while to hunt down, but I finally got the lead I needed.
The nut manual says set ups.delay.start (default 30) as the interval to wait before restarting the load (seconds) [after UPS power returns]. CyberPower UPSs restart ups.delay.start seconds after the UPS shutdown commences, regardless of the wall power status. Nut sets the value of ups.delay.start using the value of "ondelay" in ups.conf. Regardless of mains status, with:
The "ups.delay.start" bug is not well appreciated, and clearly a common cause of frustration with CyberPower UPSs.
Now, when the wall power drops, all my hosts shut down cleanly after a three minute time delay. When the wall power returns, their BIOS settings allow them to reboot as soon as the UPS supplies power -- which is immediately.
If the wall power returns before the three minute timer expires, the shutdown is cancelled. Micro-blackouts are frequent where I live, so this is a common outcome.
I have attached a zip archive of the custom changes I made. They "make install" to supply the configuration and custom scripts for the port/package.
It took some effort, but was worthwhile, as I got exactly what I wanted in the end.
Some of the sentiment I tripped across while doing the research was that sysutils/apcupsd (which does a similar function) was easier to set up -- but the ports description says it's only for APC UPS models. I got the feeling that APC UPS models were well regarded (and frequently emulated).
I have a CyberPower CP1500EPFCLCD.
The documentation for nut was above average with a user manual in both online and PDF formats, plus there was an excellent set of Configuration Examples.
I initially installed it with everything in default configuration. This worked, shutting down the server when the UPS battery got low. But I wanted the shutdown to occur three minutes after the wall power failed. There was good documentation on how to do this (its called a "timed shutdown"), but you the need to study the examples and write a number of custom scripts to get the job done.
I also had a fully functional network shutdown strategy in place, using one-shot ssh(1) commands, so I chose to set nut up using a single UPS controlling a single server (my ZFS server). When it comes time to perform the final shutdown of the ZFS server after a power failure (through nut), I just reach out using ssh to shut down all the other hosts that share the UPS. [This meant that I did not need a nut client on every host on the network, and works well in a home office context -- where I am the only user to placate.]
It took a few days to get it all running perfectly, and right near the end I tripped across a nut/CyberPower problem. It took a while to hunt down, but I finally got the lead I needed.
The nut manual says set ups.delay.start (default 30) as the interval to wait before restarting the load (seconds) [after UPS power returns]. CyberPower UPSs restart ups.delay.start seconds after the UPS shutdown commences, regardless of the wall power status. Nut sets the value of ups.delay.start using the value of "ondelay" in ups.conf. Regardless of mains status, with:
- ondelay = 0, UPS powers on the load immediately mains return;
- ondelay = -1, UPS never powers on the load, even when mains return;
- ondelay = xx, UPS powers on the load after xx (roughly) seconds after
/usr/sbin/upsdrvctl shutdown
is executed.
The "ups.delay.start" bug is not well appreciated, and clearly a common cause of frustration with CyberPower UPSs.
Now, when the wall power drops, all my hosts shut down cleanly after a three minute time delay. When the wall power returns, their BIOS settings allow them to reboot as soon as the UPS supplies power -- which is immediately.
If the wall power returns before the three minute timer expires, the shutdown is cancelled. Micro-blackouts are frequent where I live, so this is a common outcome.
I have attached a zip archive of the custom changes I made. They "make install" to supply the configuration and custom scripts for the port/package.