NUT - Network UPS Tools
Using Network UPS Tools for Controlled Shutdowns
I’ve used apcupsd quite a lot, and intended to use it to protect our qnap, but but the default on qnap is to use a system called NUT. The two are quite similar so the transition wasn’t too hard; the main problem was trying to remember I wasn’t running apcupsd.
QNAP configuration
The package was already installed on the qnap, so all there was to do was plug in the UPS (an APC Back-UPS 550G and navigate to the config section `Control Panel -> External Device-> UPS.
- USB Connection
- Turn off the server after AC Power fails for minute(s): 2
- Enable network UPS master
* notify in the event of a power failure
- 10.128.128.35
The model number and battery capacity should appear in the section at the bottom of this page.
Slave Setup
nut exists as a pacakge in debian so install it, then here are the non-empty configuration lines
$ apt-get install nut nut-client
$ cd /etc/nut
$ sed '/^#/d' upsmon.conf | sed '/^$/d'
MONITOR qnapups@10.128.128.40 1 admin <PASSWORD GOES HERE> slave
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +0"
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG /etc/killpower
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5
$ systemctl restart nut-monitor
I think that should be it, you can check communication with the qnap via upsc
$ upsc qnapups@10.128.128.40
Init SSL without certificate database
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.date: not set
battery.mfr.date: 2014/09/24
battery.runtime: 1244
battery.runtime.low: 120
battery.type: PbAc
battery.voltage: 13.5
battery.voltage.nominal: 12.0
device.mfr: APC
device.model: Back-UPS ES 550G
device.serial: 4B1439P30395
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: /dev/ttyS1
driver.parameter.synchronous: no
driver.version: 2.7.4
driver.version.data: APC HID 0.96
driver.version.internal: 0.41
input.sensitivity: high
input.transfer.high: 139
input.transfer.low: 92
input.voltage: 121.0
input.voltage.nominal: 120
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.firmware: 904.W1 .D
ups.firmware.aux: W1
ups.load: 30
ups.mfr: APC
ups.mfr.date: 2014/09/24
ups.model: Back-UPS ES 550G
ups.productid: 0002
ups.serial: 4B1439P30395
ups.status: OL
ups.timer.reboot: 0
ups.timer.shutdown: -1
ups.vendorid: 051d