NUT + Wolnut

UPS's are an invaluable asset to any environment. Not only does it save machines from unexpected shutdowns, it also gives time for generator switch overs or power restoration. To manage all my connected systems on my UPS a Raspbery Pi running NUT and a docker container tool called Wolnut will automatically manage the powering off and on of my machines. This is achieved through NUT's built in client / server functionality and Wolnuts' Wake on LAN (WOL) magic packet features.

Installing Raspbian via CLI

The steps to install raspbian via CLI are very easy and takes 10-15 minutes. You can do this with any Raspbian image. See Installing Raspbian via CLI for detailed steps. Once this is complete you can move to the next steps

Setting up NUT server

First, NUT must be installed on the system which will be monitoring the UPS. In my case that is a Raspberry Pi 4 running Raspbian.

# Update and install NUT
sudo apt update && upgrade
sudo apt install NUT

Once installed, we can plug in the data cable from the UPS to the machine. We can then verify the install and find the information needed to complete configuration buy running this simple command:

# Get UPS information
sudo nut-scanner -U
example output
wolnut@nut:~$ sudo nut-scanner -U
Scanning USB bus.
[nutdev1]
	driver = "usbhid-ups"
	port = "auto"
	vendorid = "051D"
	productid = "0002"
	product = "Back-UPS RS 1300 LCD FW:838.H7 .D USB FW:H7"
	serial = "3B0945X40544"
	vendor = "American Power Conversion"
	bus = "001"
# Configure NUT 

## In /etc/nut/ups.conf

[ups]
        driver = "usbhid-ups"
        port = "auto"
        vendorid = "051D"
        productid = "0002"
        serial = "3B0945X40544"
        desc = "UPS for Networking and PowerEdge"
        sdorder = -1


## In /etc/nut/upsd.conf

LISTEN 0.0.0.0 3493

## In /etc/nut/upsd.users

[upsmon]
password = password
upsmon primary
actions = SET
instcmds = ALL

[observer]
password = password
upsmon secondary


## In /etc/nut/upsmon.conf

MONITOR poweredgeups@localhost 1 upsmon PowerOutage primary

## Change in /etc/nut/nut.conf 

MODE=netserver

# Enable and Restart services
sudo systemctl enable nut-server nut-monitor
sudo systemctl start nut-server nut-monitor
sudo systemctl status nut-server nut-monitor 

# Check if working correctly
upsc ups

Configuring Proxmox NUT client

# Install 
apt update && upgrade 
apt install nut-client

## Change in /etc/nut/nut.conf 

MODE=netclient

# Remove upsmon.conf and upssched.conf
rm -rf /etc/nut/upsmon.conf 
rm -rf /etc/nut/upssched.conf
# Add from https://technotim.live/posts/NUT-server-guide/#linux-nut-client-remote

# Add cmd from above link
sudo nano /etc/nut/upssched-cmd
chmod +x /etc/nut/upssched-cmd

# make sure this directory exists
mkdir /etc/nut/upssched/

systemctl restart nut-client
systemctl status nut-client

Configuring Wolnut

mkdir wolnut 
cd wolnut 

nano config.yaml

Install Docker

docker run -d \
  --name wolnut \
  --restart unless-stopped \
  -v ~/wolnut:/config \
  --network host \
  hardwarehaven/wolnut:latest
wolnut output
2025-07-11 05:01:28,090 [INFO] WOLNUT started. Monitoring UPS: poweredgeups@localhost
2025-07-11 05:01:28,168 [INFO] UPS power status: OL, Battery: 100%
2025-07-11 06:59:43,701 [WARNING] UPS switched to battery power.
2025-07-11 07:09:50,383 [INFO] Power restored, waiting 59 seconds before waking clients...
2025-07-11 07:10:08,523 [INFO] Power restored, waiting 41 seconds before waking clients...
2025-07-11 07:10:26,667 [INFO] Power restored, waiting 23 seconds before waking clients...
2025-07-11 07:10:44,811 [INFO] Power restored, waiting 5 seconds before waking clients...
2025-07-11 07:11:02,955 [INFO] Power restored and battery >= 25%. Preparing to send WOL...
2025-07-11 07:11:02,956 [INFO] Sending WOL packet to Proxmox at 84:2b:2b:61:de:20
2025-07-11 07:11:39,243 [INFO] Sending WOL packet to Proxmox at 84:2b:2b:61:de:20
[...]
2025-07-11 07:19:46,110 [INFO] Proxmox is online.
2025-07-11 07:19:46,111 [INFO] Power Restored and all clients are back online!

References

https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/master/usr/lib/raspberrypi-sys-mods/firstboot
https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/master/usr/lib/raspberrypi-sys-mods/init_config
https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/master/usr/lib/raspberrypi-sys-mods/imager_custom

https://gist.github.com/lpenz/ef21bb38a7aa12ebde17fa719a8546b5
https://technotim.live/posts/NUT-server-guide/#linux-nut-client-remote
https://github.com/hardwarehaven/wolnut/tree/main

https://maraelite.shoprenter.hu/custom/maraelite/image/data/PDF/Dell/PE_R710/poweredge-r710-owner-manual.pdf
https://www.reddit.com/r/homelab/comments/5vuqll/comment/m6e60ne/
https://www.reddit.com/r/homelab/comments/5vuqll/comment/madbp0t/
https://www.reddit.com/r/homelab/comments/1h0f3hv/r710_auto_restart_after_crash_or_shutdown/
https://i.dell.com/sites/doccontent/business/solutions/engineering-docs/en/Documents/server-poweredge-r710-tech-guidebook.pdf
https://dl.dell.com/manuals/all-products/esuprt_ser_stor_net/esuprt_poweredge/broadcom-netxtreme-adapters_reference guide2_en-us.pdf