Since my Ugreen DXP2800 is plugged into my APC650 for power, which is managed by my Raspberry Pi (running as the nut server), I'm running nut on my NAS as a client
Network UPS Tools (NUT) is an open-source software suite that lets you monitor and manage Uninterruptible Power Supplies (UPS) and other power devices across multiple systems. It provides a standardized way to interact with hundreds of different UPS models, Power Distribution Units (PDUs), and related hardware, ensuring consistent monitoring, alerting, and automated shutdowns during power events
I have two NVME SSDs installed in my DXP2800, mirrored, that I use to hold apps and docker containers. It's configured as /volume2. All of my docker containers are run from /volume2/docker
This guide assumes that another system is running the nut server and is USB-attached to a UPS (in this specific guide I'm using an APC650).
mkdir /volume2/docker/nut mkdir /volume2/docker/nut/config mkdir /volume2/docker/nut/logs
In /volume2/docker/nut create docker-compose.yml
services:
nut-client:
image: instantlinux/nut-upsd
container_name: nut-client
restart: unless-stopped
entrypoint: ["upsmon"] # This and the next line are needed to get this to run as a client
command: ["-D"]
environment:
- TZ=America/New_York
volumes:
- ./config:/etc/nut
In /volume2/docker/nut/config you want:
nut.conf upsd.conf upsd.users upsmon.conf
Since the NAS is running as a nut client, nut.conf should contain:
MODE=netclient
Add this to upsd.conf:
LISTEN 0.0.0.0
Add this to upsd.users. You should have a matching entry in upsd.users on your nut server:
[ugreen] password = YOUR-PASSWORD upsmon slave
Add this to upsmon.conf:
MONITOR apc600@localhost 1 YOUR_USERNAME YOUR_PASSWORD master RUN_AS_USER nut POWERDOWNFLAG /etc/nut/powerdown.flag SHUTDOWNCMD "/sbin/shutdown -h +0"
From within /volume2/docker/nut run:
docker compose up -d
docker logs nut-client
You should see something like:
Trying to connect to UPS [apc600@192.168.xx.xx] Logged into UPS apc600@192.168.xx.xx
docker exec -it nut-client upsc apc600@pi
You should see things like:
battery.charge: 100 battery.charge.low: 10 battery.charge.warning: 50 battery.date: 2001/09/25 battery.mfr.date: 2024/10/24 battery.runtime: 3720
If you find my content useful, please consider supporting this page: