Monitoring UPS with NUT

In this article , i’m going to show you how you can set up monitoring of a cheap UPS with NUT , and set your server to correctly shutdown 10 minutes after power a fail , to prevent data loss.

The area where i’ve built my house is still under development, so brown-outs and black-outs are pretty common .

It happened more than once to come home and find my server off and the ups batteries depleted , so i decided to change my setup and get alerts by e-mail when power goes out.

I will be using the same server i have for Openstack, to monitor and send out alerts .

The UPS is connected to the server using a USB cable .

Connect your USB cable , and run :

root@cloud.local:/# dmesg

[80186.156023] usb 4-2: new low-speed USB device number 2 using uhci_hcd
[80186.330039] usb 4-2: New USB device found, idVendor=0665, idProduct=5161
[80186.330046] usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[80186.330049] usb 4-2: Product: USB to Serial
[80186.330051] usb 4-2: Manufacturer: INNO TECH
[80186.360169] hid-generic 0003:0665:5161.0003: hiddev0,hidraw2: USB HID v1.00 Device [INNO TECH USB to Serial] on usb-0000:00:1d.2-2/input0

Save your UPS descriptor for the next steps :


Install NUT :

apt-get install nut nut-cgi

Add UPS config, for my UPS i used the name : mustek-poweragent-2012

root@cloud.local:/# nano /etc/nut/ups.conf

And add the following lines :

driver = blazer_usb
desc = mustek
vendorid = 0665
port = auto

Start ups monitor :

upsdrvctl start

It’s possible that you will receive an error message , like so :

Can't claim USB device [0665:5161]: could not detach kernel driver from
interface 0: Operation not permitted
Driver failed to start (exit status=1)

It’s a permission problem , which we can fix :

root@cloud.local:/# nano /etc/udev/rules.d/mustek-poweragent-2012.rules

And add the lines :

SYSFS{idVendor}=='0665', SYSFS{idProduct}=='5161', MODE='0666'

After which you need to reboot your server






Leave a comment

Your email address will not be published.


Solve : *
28 + 2 =