I have messed around with NUT to trigger a graceful shutdown of my home server running Ubuntu Server. I have struggled with setting NUT up on bare metal, but would like a gui anyway. I saw PVE-UPS which looks good, but I think but I think it is meant for Proxmox. Any alternatives, or a spin of PVE-UPS for docker compose anybody know about?
Note to self: Get around to wiring my UPS onto my management network for monitoring and graceful shutdown of non-essential stuff.
mbirth@lemmy.ml 3 weeks ago
What was the difficulty with NUT for you? The setup is pretty straightforward, IMHO.
Image
Should be easy to wrap in a container, too.
stoicmaverick@lemmy.world 3 weeks ago
I was hoping to setup a server and clients to shutdown the other Raspberry Pis and such, scattered around the house if the main server senses a power failure.
Also, I had an issue where it insisted on triggering a shutdown the SECOND the UPS triggered, even if it came right back. I might take another swing at it at some point, but I liked the look of that PVE-UPS things.
tychosmoose@lemmy.world 3 weeks ago
A basic NUT configuration does an immediate shutdown as soon as an ONBATT status is reached (upssched.conf has “at ONBATT execute…”, which causes the upssched-cmd to run the shutdown command immediately). But you can change that to a timer, which can be cancelled if the UPS goes back online, or only shutdown at LOWBATT.
It’s complicated, but NUT should be able to do everything you have stated as a goal. But it takes some testing.
One thing I found helpful while setting it up is the Dummy UPS driver that is included in the documentation. Rather than plug and unplug a physical UPS during testing you can make text files with various ups statuses and cp one to the dummy’s input file target to make it change to battery power or back online. Use logger to log information into the system journal from upssched-cmd to see what’s running in your script (with a unique keyword to grep on). Monitor in another terminal with
journalctl -f | grep yourkeywordto view your messages. This made it much easier to get the upssched stuff sorted out.One of my goals was unattended power-on management for when I was away from home. If power returned for an amount of time, send power commands to various smart outlets to bring everything back up in sequence. So I used a pretty big upssched-cmd, with timers for both shutdown and power up and different UPS battery levels (no power up until 30% battery, for example). It would have been pretty difficult to debug without the dummy UPS.
Anyway, NUT is really powerful.
mbirth@lemmy.ml 3 weeks ago
On clients you mostly have to set
MODE=netclientin thenut.confand modify theupsmon.confaccording to the manual and detailed manual. By default, it should only shutdown systems when reaching a “low battery” situation, not immediately when switching to battery power.