DeskTux

Linux on Desktops

User Tools

Site Tools


apps:nut

NUT

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.

Installation

The installation is straight forward.

apt install nut nut-client nut-server

Preparation

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.

Configuration

To configure NUT you need to edit a couple of files.

/etc/nut/nut.conf

Set mode to standalone.

/etc/nut/ups.conf

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

/etc/nut/upsd.users

Create a user that is allowed to monitor:

[upsmon]
        password = <yourverysecretpassword>
        upsmon master

/etc/nut/upsmon.conf

Enter a UPS that should be monitored:

MONITOR myups@localhost 1 upsmon <yourverysecretpassword> master

Start

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

Discussion

Enter your comment:
T Q N G W
 
apps/nut.txt · Last modified: 2024-05-18 18:34 by jens