Installing NUT (Network UPS Tools) on Ubuntu 18.04 LTS
Original How-To URL: https://zackreed.me/installing-nut-on-ubuntu/
Install Nut
apt-get install nut
Edit /etc/nut/ups.conf
vi /etc/nut/ups.conf
Paste the foollowing at the bottom. Mine’s an APC-1500, so I’ve set it to a recognizable name (apc-1500)
[apc-1500]
driver = usbhid-ups
port = auto
Create the following directories and reboot machine
mkdir /var/run/nut
chown root:nut /var/run/nut
chmod 770 /var/run/nut
Start NUT
upsdrvctl start
Should give the following output
Network UPS Tools - UPS driver controller 2.4.3
Network UPS Tools - Generic HID driver 0.34 (2.4.3)
USB communication driver 0.31
Using subdriver: APC HID 0.95
Setup NUT to listen on Port 3493
vi /etc/nut/upsd.conf
Add the following lines where <IPADDRESS> is the IP of your machine
LISTEN 127.0.0.1 3493
LISTEN ::1 3493
LISTEN <IPADDRESS> 3493
Set the mode
Edit /etc/nut/nut.conf:
vi /etc/nut/nut.conf
Enter the following:
MODE=netserver
Start the network data server
upsd
Check the status
upsc apc-1500@localhost ups.status
Should output the following
OL
OL means your system is running On Line power. If you want to see all the info, try this instead
upsc apc-1500@localhost
Should output the following
...
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.date: 2054/00/39
battery.mfr.date: 2008/10/20
---
Disable the beeper if needed
upscmd apc beeper.disable
Setup users to access the info and make changes.
vi /etc/nut/upsd.users
Add monitor master user and a monitor slave user for remote machines
[monuser]
password = PASSWORD_REPLACE
actions = SET FSD
instcmds = ALL
upsmon master
# or upsmon slave
[monuserslave]
password = slave
upsmon slave
Reload upsd
upsd -c reload
Setup upsmon for our machine
vi /etc/nut/upsmon.conf
Paste the following
MONITOR apc-1500@localhost 1 local_mon PASSWORD_REPLACE master
Setup Nut in standalone mode
vi /etc/nut/nut.conf
Paste the following
MODE=standalone
Start NUT
service nut start
Setting up a Client (Slave) Computer
Install NUT
apt-get install nut
Edit /etc/nut/nut.conf
vi /etc/nut/nut.conf
Paste the following
MODE=netclient
Set your upsmon.conf to match the setup for your monuserslave above and the ip address of your master nut-server
vi /etc/nut/upsmon.conf
Paste the following where <IPADDRESS> is the ip of your NUT Server and <PASSWORD> is the password of your monuserslave password from above
MONITOR apc-1500@<IPADDRESS> 1 monuserslave <PASSWORD> slave
Restart your nut-client
service nut-client restart
Test with the following command where <IPADDRESS> is the IP of your NUT server
upsc apc-1500@<IPADDRESS>
Should output the following
Init SSL without certificate database
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.date: 2054/00/39
battery.mfr.date: 2008/10/20
battery.runtime: 156
battery.runtime.low: 360
battery.type: PbAc
battery.voltage: 26.7
battery.voltage.nominal: 24.0
device.mfr: American Power Conversion
device.model: Back-UPS RS 1500 LCD
device.serial: 8B0843R44379
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.version: 2.6.4
driver.version.data: APC HID 0.95
driver.version.internal: 0.37
input.sensitivity: medium
input.transfer.high: 139
input.transfer.low: 88
input.voltage: 122.0
input.voltage.nominal: 120
ups.beeper.status: disabled
ups.delay.shutdown: 20
ups.firmware: 839.H7 .D
ups.firmware.aux: H7
ups.load: 29
ups.mfr: American Power Conversion
ups.mfr.date: 2008/10/20
ups.model: Back-UPS RS 1500 LCD
ups.productid: 0002
ups.realpower.nominal: 865
ups.serial: 8B0843R44379
ups.status: OL LB
ups.test.result: No test initiated
ups.timer.reboot: 0
ups.timer.shutdown: -1
ups.vendorid: 051d