NUT, the Network UPS Tools, make it possible to monitor several kinds and types of UPS systems on a single node or even throughout a network.
To make sure that my NUC and modem do not fail on a power outage, I purchased a PowerWalker VI 650 SHL UPS. My NUC runs backups and monitoring, so I want it to have as little downtime as possible.
Getting this UPS to work with NUT however, was more of a struggle than expected.
The installation is straight forward.
apt install nut nut-client nut-server
This step took the longest to figure out for me. For NUT to recognize your UPS correctly, you need to implement some UDEV rules. To do so, simply copy the provided rules to /etc/udev/rules.d
:
cp /lib/udev/rules.d/62-nut-usbups.rules /etc/udev/rules.d
Afterwards, the simplest way to activate them is a reboot.
To configure NUT you need to edit a couple of files.
Set mode
to standalone
.
Add this block for your UPS:
[myups] driver = usbhid-ups port = auto vendorid = 06da desc = "My UPS"
To get the vendorid
simply use lsusb
. For me it looks like this (check the second line):
Bus 002 Device 004: ID 152d:9561 JMicron Technology Corp. / JMicron USA Technology Corp. Bus 002 Device 006: ID 06da:ffff Phoenixtec Power Co., Ltd Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Create a user that is allowed to monitor:
[upsmon] password = <yourverysecretpassword> upsmon master
Enter a UPS that should be monitored:
MONITOR myups@localhost 1 upsmon <yourverysecretpassword> master
Afterwards, start the necessary services. First, the driver:
systemctl start nut-driver
After that, the command upsc myups
should produce some output:
Init SSL without certificate database battery.charge: 100 battery.runtime: 3600 battery.type: PbAc battery.voltage: 14 device.mfr: PPC device.model: Offline UPS device.serial: 000000000 device.type: ups driver.name: usbhid-ups driver.parameter.pollfreq: 30 driver.parameter.pollinterval: 2 driver.parameter.port: auto driver.parameter.synchronous: no driver.parameter.vendorid: 06da driver.version: 2.7.4 driver.version.data: Phoenixtec/Liebert HID 0.3 driver.version.internal: 0.41 ups.load: 7 ups.mfr: PPC ups.model: Offline UPS ups.productid: ffff ups.serial: 000000000 ups.status: OL CHRG ups.vendorid: 06da
Finally, start the UPS services and you are good to go:
systemctl start nut-server systemctl start nut-client systemctl start nut-monitor