How-To: install NUT on Ubuntu 10.10 Maverick Meerkat
In this How-to I will explain how to install and configure Network UPS Tools on Ubuntu 10.10 Maverick Meerkat.
I will configure it with my APC BackUPS RS 800.
Install the package
1 sudo apt-get install nut
Now we need to find out what driver we need to use.
Check it out at the Hardware Compatibility List.
In my case the driver is usbhid-ups.
Edit /etc/nut/ups.conf and add the following
1
2
3 [apc]
driver = usbhid-ups
port = auto
Start the driver
1 | sudo upsdrvctl start |
but you can get this error
1
2
3
4
5 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
Can’t chdir to /var/run/nut: No such file or directory
Driver failed to start (exit status=1)
Do the following to fix the problem
1
2
3 sudo mkdir /var/run/nut
sudo chown root:nut /var/run/nut
sudo chmod 770 /var/run/nut
Try again with the command
1 sudo upsdrvctl start
if it works, you should have an output like this
1
2
3
4 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
Now edit /etc/nut/upsd.conf and add the following lines
1
2 LISTEN 127.0.0.1 3493
LISTEN ::1 3493
This way, upsd will only listen to localhost port 3493/tcp.
Start the network data server
1
2
3
4
5
6 sudo upsd
Network UPS Tools upsd 2.4.3
listening on ::1 port 3493
listening on 127.0.0.1 port 3493
Connected to UPS [apc]: usbhid-ups-apc
Check the UPS status
1
2
3 sudo upsc apc@localhost ups.status
OL
OL means your system is running on line power.
Look at all of the status data which is being monitored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 sudo upsc apc@localhost
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.date: 2001/09/25
battery.mfr.date: 2007/03/14
battery.runtime: 641
battery.runtime.low: 120
battery.temperature: 29.2
battery.type: PbAc
battery.voltage: 27.4
battery.voltage.nominal: 24.0
device.mfr: APC
device.model: Back-UPS BR 800
device.serial: QB0711130221
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.version: 2.4.3
driver.version.data: APC HID 0.95
driver.version.internal: 0.34
input.sensitivity: high
input.transfer.reason: input voltage out of range
input.voltage: 232.0
input.voltage.nominal: 230
output.voltage: 230.0
output.voltage.nominal: 230.0
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.firmware: 9.o2 .I
ups.firmware.aux: o2
ups.load: 20.0
ups.mfr: APC
ups.mfr.date: 2007/03/14
ups.model: Back-UPS BR 800
ups.productid: 0002
ups.serial: QB0711130221
ups.status: OL
ups.test.result: No test initiated
ups.timer.reboot: 0
ups.timer.shutdown: -1
ups.vendorid: 051d
Now edit /etc/nut/upsd.users and add the following lines
1
2
3
4
5
6 [monuser]
password = mypass
actions = SET
instcmds = ALL
upsmon master
# or upsmon slave
change the password field with a real password.
Reload upsd
1 upsd -c reload
Edit /etc/nut/upsmon.conf, create a monitor directive for upsmon
1 MONITOR apc@localhost 1 local_mon mypass master
Edit /etc/nut/nut.conf and change the mode to Standalone
1 MODE=standalone
Now you can start NUT with
1 sudo service nut start
If you want to enable e-mail notifications for UPS events, as suggested by Witwolf, edit again /etc/nut/upsmon.conf and add
1
2
3
4
5
6
7
8
9
10
11
12 NOTIFYCMD /usr/local/bin/nut-notify.sh
NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC
NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC
# NOTIFYFLAG FSD SYSLOG+WALL
# NOTIFYFLAG COMMOK SYSLOG+WALL
# NOTIFYFLAG COMMBAD SYSLOG+WALL
NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC
NOTIFYFLAG REPLBATT SYSLOG+WALL+EXEC
NOTIFYFLAG NOCOMM SYSLOG+WALL+EXEC
NOTIFYFLAG NOPARENT SYSLOG+WALL+EXEC
Create the script /usr/local/bin/nut-notify.sh and paste the following
1
2 #!/bin/sh
echo "$@" | mail -s "NUT Notice" test@example.com
make it executable
1 sudo chmod +x /usr/local/bin/nut-notify.sh
Enjoy 
SOURCES:
Network UPS Tools: User Manual – Configuration notes
Witwolf: My new APC Back-UPS Pro 900 arrived!
