Install Network UPS Monitoring Server


I have been using an Uninterruptable Power Supply (UPS) on and off for years. It was in the last few years when we noticed the lights brightening and dimming on halogen bulbs I decided to look into it deeper and fully realising how important a clean power source was. With that and having many devices at home, I wanted a way to monitor and notify devices to shutdown when needed.


I found two UPS monitoring tools on Debian. APCUPSD seemed better suited to a signle machine setup which can monitor one or more UPS. NUT is better suited to multiple machines with their own UPS to monitor.

They both have a lot of overlapping features and complexity in setup are about the same for a single UPS. NUT seems to go further by allowing user account setup and therefore more extensible.

Install NUT

NUT is a package available in Ubuntu’s repository so install is very easy:
sudo apt install nut


This guide goes through a USB UPS setup. Make sure the UPS USB is plugged in.

Find the UPS by listing the USB devices connected:
lsusb output

In the example above, I’m using an American Power Conversion (APC) unit. Make a note of the output specifically the part after “ID” e.g 051d.

Edit /etc/nut/ups.conf and add the following:

xretry = 5
pollinterval = 2

driver = usbhid-ups
port = auto
vendorid = “051d”
desc = “Home UPS”

if there are any other lines like pollinterval = 5 are commented out by putting a “#” at the start of the line.

Find the device rules and copy it to the system directory. The file differs from machine to machine so run the following command to locate the “-nut-usbups.rules”:
sudo ls /lib/udev/rules.d/ | grep nut

Then move the file. In my case, it was assigned 62 as the rule file name:
sudo cp /lib/udev/rules.d/62-nut-usbups.rules /etc/udev/rules.d/

Restart the computer to pick up the device and associate rules:
sudo shutdown -r now

Start the UPS service:
sudo upsdrvctl start

If your output looks like this:
Belkin USB

Then it has found a different USB device. Make sure the vendor ID (or some other parameter. See here for details on other filtering mechanisms.

If it successfully connected denoted in the ouput by displaying details about the USB driver then continue below otherwise go back and check your configuration.

Create a user who can monitor the UPS. Edit /etc/nut/upsd.users with the following:

password = mypassword
actions = SET
instcmds = ALL
upsmon master

Replace mypassword with a suitable password.

Next, allow the connected machine to monitor the UPS with the user configured above. The main thing to add is the monitor line in /etc/nut/upsmon.conf:
MONITOR myups@localhost 1 local_mon mypassword master

Change the following:

The rest of the filt can be tailored such as the command to execute and when to shutdown the machine. See here for details.

If you need other devices on the network to monitor the UPS then edit/etc/nut/upsd.conf. Uncomment the lines starting with LISTEN by removing # at the start of the line. Add the IP addresses of the devices allowed to monitor the device. Alternatively, set the listen from to allow any device on the network although this is not recommended. The number 3493 is the port. Feel free to change this if needed.
NUT upsd example

Lastly, add the line below to set up NUT as a server (as opposed to standalone mode) so that it will wait for connections from other devices:


The above setup will now monitor and when power is lost shutdown the machine. I have tried using this on a Raspberry Pi with great success and the above setup can be extended to notify other devices on the network if needed and integrates with Home Assistant.

Install and configure a standalone UPS using NUT on Ubuntu

Installing NUT on Ubuntu

How to Use APC UPS with Two or More Computers – Master Slave Setup

About Danny

I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in Infrastructure and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *.

All comments must go through an approval and anti-spam process before appearing on the website. Please be patience and do not re-submit your comment if it does not appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.