NUT

From Mark Furneaux's Wiki
Jump to: navigation, search

NUT, or Network UPS Tools, is a system for monitoring UPSes over a network.

Installation

Install NUT with:
# apt install nut

Configuration

Server

Add a UPS driver in /etc/nut/ups.conf:

[cp1500pfclcd]
      driver = usbhid-ups
      port = auto
      desc = "tesla"
      sdorder = -1

You will need to comment out maxretry = 3 since it is not supported by upshid-ups.

Start the driver with:
# upsdrvctl start

Add the addresses to listen on in /etc/nut/upsd.conf:

LISTEN 127.0.0.1 3493
LISTEN ::1 3493
LISTEN 192.168.30.100 3493
LISTEN 192.168.10.100 3493

Set the operating mode in /etc/nut/nut.conf:

MODE=netserver

Create 2 users in /etc/nut/upsd.users:

[upsmonuser]
        password = <passwd>
        actions = SET FSD
        instcmds = ALL
        upsmon master

[upsmonuserslave]
        password = <passwd>
        upsmon slave

Setup a monitor on the master in /etc/nut/upsmon.conf:

MONITOR cp1500pfclcd@localhost 1 upsmonuser <passwd> master

Tear down the temporary daemons:
# upsd -c stop
# upsdrvctl stop

Start the daemon with:
# systemctl start nut-server.service

Start the monitor with:
# systemctl start nut-client.service

Client

Set the operating mode in /etc/nut/nut.conf:

MODE=netclient

Setup a monitor on the master in /etc/nut/upsmon.conf:

MONITOR cp1500pfclcd@192.168.30.100 1 upsmonuserslave <passwd> slave

Optionally set a notify command and set the notify types in /etc/nut/upsmon.conf:

NOTIFYCMD /usr/local/bin/upschange.sh

NOTIFYFLAG ONBATT       SYSLOG+WALL+EXEC

Start the client with:
# systemctl start nut-client.service

Fixes

Some CyberPower (CPS) UPSes cannot be polled at the standard interrupt rate of 0.5Hz and will crash the driver after some random period of time. The easiest workaround is to drop the poll period to 10s. Do this by adding the following to the global area of /etc/nut/ups.conf:

pollinterval = 10