How to shutdown automatically when UPS gets empty?

Started by mbuerkle, June 05, 2022, 01:36:14 PM

Previous topic - Next topic
Hi all,

i have running OpnSense on an PC Engines APU.1D4 board board.
Together with some other devices the system is powered by an EATON Ellipse ECO 650 which is connected to the APU.1D4 board by USB.
In the nut diagnostics the values of the UPS are shown.

Now i would like to configure my OpnSense to shutdown when the battery charge level of the UPS goes under let's say 20 %.

Is this possible?
In the WebGUI i can't find any configuration.

Thanks!
mbuerkle

The NUT plugin should come with it own set of configuration pages in the UI. After plugin installation you may need to force-refresh your browser window for new menu parts to show up.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Hello, sorry if it sounds a bit of a noob question. I do set my VMs, NAS, and other systems to shutdown when power is out, but usually not my (dumb) switch, Wifi AP, and routers. I usually still have internet even if power is out for as long as my UPS(s) batteries last.
I think OPNsense is an embedded install, and I assume it runs mostly from memory. Is there actually any risk of potential problems if OPNsense is not shutdown properly?

June 05, 2022, 08:49:24 PM #3 Last Edit: June 06, 2022, 04:29:41 PM by pmhausen
Quote from: spyware-avoidance on June 05, 2022, 08:26:52 PM
I think OPNsense is an embedded install
Yes. Sort of.

Quote from: spyware-avoidance on June 05, 2022, 08:26:52 PM
and I assume it runs mostly from memory.
But no. It runs from disk/ssd/whatever storage.

Quote from: spyware-avoidance on June 05, 2022, 08:26:52 PM
Is there actually any risk of potential problems if OPNsense is not shutdown properly?
Yes. If you are running on UFS there is a non-zero probability your device will break in a way rendering it unbootable unattended after a power outage. A ZFS install is much more resilient to that scenario, that's why I largely prefer ZFS today.

HTH,
Patrick
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

The UPS default is using battery.charge.low or battery.runtime.low. Usually something like 20%.

That said, draining the batteries seems bad so i usually overrule the threshold with "ignorelb" and "lowbatt = 86". But for the last one you have to calculate the value. You need to know the power consumption and the capacity. In my case it will shutdown the stuff after a couple of minutes.

I find 20% somewhat dangerous in my case (attached a NAS)
* Services can "hang" or timeout
* You are starting a shutdown process. This will consume more power
*  Usually shutdown will write to disk. Especially this moment you do not want to reach the empty UPS battery. In that case i think a idle power loss is safer.