UPS Support

I have written some code to monitor my UPS connected to my server.
You have to install upsd/nut and setup ACL.
Define a UPS device with address field filled with the name of your ups as you defined it in the config files.
Check parameters and enable module in the Setup UPS Monitor menu.

Only 3 parameters are monitored, ups temperature, input voltage and ups status.
OL Online
OB On Battery
LB Low Battery

I have tested it with my APC SmartUPS 1000.

Install Pre-Requisites

sudo apt-get install nut

Older Ubuntu versions than 10.04 also need upsd

sudo apt-get install upsd

Check on which USB port the UPS-USB cable is connected;

lsusb  (need more information use: lsusb -v)

Here some of my config file snippets.

cat /etc/nut/ups.conf
[smartups1000]
        driver = apcsmart
        port = /dev/ttyUSB6

cat /etc/nut/upsd.conf
ACL mynet 192.168.100.0/255.255.255.0
ACL localhost 127.0.0.1/32

ACCEPT mynet
ACCEPT localhost
cat /etc/nut/upsmon.conf
POWERDOWNFLAG /etc/killpower
MONITOR smartups1000@localhost 1 monmaster MASTERPASS master
SHUTDOWNCMD "/sbin/shutdown -h now" 
cat /etc/nut/hosts.conf
MONITOR smartups1000@localhost "Cyberjunky's UPS" 
cat /etc/nut/upsd.users
[admin]
        password = ADMINPASS
        allowfrom = localhost
        actions = SET
        instcmds = ALL

[monmaster]
        password = MASTERPASS
        allowfrom = localhost
        upsmon master

[monuser]
        password = USERPASS
        allowfrom = localhost
        upsmon slave
$ upsdrvctl start
Network UPS Tools - UPS driver controller 2.2.1-
Network UPS Tools (version 2.2.1-) - APC Smart protocol driver
    Driver version 1.99.8, command table version 2.0
Detected SMART-UPS 1000 [QS9943117611] on /dev/ttyUSB6
$ upsc smartups1000@localhost
battery.alarm.threshold: 0
battery.charge: 100.0
battery.charge.restart: 00
battery.date: 10/22/99
battery.packs: 000
battery.runtime: 21780
battery.runtime.low: 120
battery.voltage: 27.33
battery.voltage.nominal: 024
driver.name: apcsmart
driver.parameter.pollinterval: 2
driver.parameter.port: /dev/ttyUSB6
driver.version: 2.2.1-
driver.version.internal: 1.99.8
input.frequency: 50.00
input.quality: FF
input.sensitivity: H
input.transfer.high: 253
input.transfer.low: 196
input.transfer.reason: S
input.voltage: 227.5
input.voltage.maximum: 228.8
input.voltage.minimum: 226.2
output.voltage: 227.5
output.voltage.nominal: 230
ups.delay.shutdown: 020
ups.delay.start: 000
ups.firmware: 60.11.I
ups.id: UPS_IDEN
ups.load: 000.0
ups.mfr: APC
ups.mfr.date: 10/22/99
ups.model: SMART-UPS 1000
ups.serial: QS9943117611
ups.status: OL
ups.temperature: 030.1
ups.test.interval: 1209600
ups.test.result: NO

Fix permissions:
cd /etc/nut
sudo chown nut upsd.users upsd.conf hosts.conf
sudo chmod 700 upsd.users upsd.conf hosts.conf

Startup Log Entries:
2008/11/12 23:44:37  UPS TCP interface enabled.
2008/11/12 23:44:37  UPS TCP interface connecting to 192.168.100.2:3493
2008/11/12 23:44:37  UPS socket connected.

Related Resources

  • Added by johnbrand over 5 years ago

    On Ubuntu lucid (10.04) the install of the monitoring of an ups goes different.
    You can't install upsd and nut. You only need to install nut.

    If you like I can post my install.

  • Added by sj3fk3 over 3 years ago

    It would be nice to see apcupsd support instead of nut

Updated by: scdhome, Updated over 2 years ago
Access count: 65797 since 2011-08-25

smartups.gif (15.3 KB) rdnzl, 08/23/2011 02:31 PM

Also available in: PDF HTML TXT