Setting Up Network UPS Tools (NUT) for APC UPS Devices on Linux

Setting Up Network UPS Tools (NUT) for APC UPS Devices on Linux

Home Lab, Infrastructure

When you’re running critical systems — whether it’s a home lab, a small business server, or production workloads — power outages can cause real headaches. That’s where an Uninterruptible Power Supply (UPS) comes in. But to make the most of it, your server needs to know when the UPS is running on battery, when it’s low, and when to shut down gracefully.

That’s exactly what Network UPS Tools (NUT) does. In this guide, we’ll walk through setting up NUT on Linux with an APC UPS.


What is NUT?

Network UPS Tools (NUT) is an open-source suite that provides:

  • Drivers for a wide range of UPS devices (including APC).
  • A monitoring daemon to track UPS status.
  • Shutdown coordination for multiple systems.
  • Remote monitoring over the network.

It’s highly flexible, works across many UPS models, and is widely used in both enterprise and homelab environments.


Prerequisites

  • A Linux system (Debian/Ubuntu, RHEL, or similar).
  • An APC UPS connected via USB or serial cable.
  • Root or sudo access.

For the purposes of this post, I will be connecting 2x APC UPS-B Back-UPS XS 1400U UPS's to a single Raspberry Pi5


Step 1: Install NUT

On Debian/Ubuntu:

sudo apt update
sudo apt install nut nut-client nut-server

Step 2: Identify Your UPS

Plug in your APC UPS via USB, then run:

lsusb

You should see something like:

Bus 001 Device 005: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 001 Device 004: ID 051d:0002 American Power Conversion Uninterruptible Power Supply

This tells us the UPS is detected.


Step 3: Configure NUT Driver

Edit /etc/nut/ups.conf:

# Generic APC UPS
[apc]
    driver = usbhid-ups
    port = auto
    desc = "APC UPS"

# Specific to my UPSs
[apcupsa]
driver = usbhid-ups
desc = "APC UPS-A Back-UPS XS 1400U 4B2028P50251"
port = auto
vendorid = 051d
productid = 0002
serial = serial1

[apcupsb]
driver = usbhid-ups
desc = "APC UPS-B Back-UPS XS 1400U 4B2028P50042"
port = auto
vendorid = 051d
productid = 0002
serial = serial2
  • apc is the UPS name (you can choose your own).
  • usbhid-ups is the driver used for most modern APC UPS devices.
  • port = auto lets NUT detect the UPS automatically.

Test the driver:

sudo upsdrvctl start

Step 4: Configure UPS Daemon

Edit /etc/nut/upsd.conf:

LISTEN 0.0.0.0 3493

This tells NUT to listen for connections on localhost.

Then edit /etc/nut/upsd.users:

[upsmon]
    password = strongpassword
    upsmon primary
    instcmds = ALL

Step 5: Configure NUT Client

Edit /etc/nut/upsmon.conf:

MONITOR apcupsa@localhost 1 upsmon strongpassword primary
MONITOR apcupsb@localhost 1 upsmon strongpassword primary

This means:

  • Monitor the UPS named apc at localhost.
  • Use the admin user with the password.
  • master indicates this system will manage shutdowns.

Step 6: Set NUT Mode

Edit /etc/nut/nut.conf:

MODE=netserver

(Use netserver or netclient if you want multiple systems connected to the UPS.)


Step 7: Start and Enable Services

sudo systemctl enable nut-server
sudo systemctl enable nut-monitor
sudo systemctl start nut-server
sudo systemctl start nut-monitor

Step 8: Verify

Check UPS status:

upsc apc@localhost

You should see output like:

battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.date: 2001/09/25
battery.mfr.date: 2020/07/10
battery.runtime: 4088
battery.runtime.low: 120
battery.type: PbAc
battery.voltage: 27.3
battery.voltage.nominal: 24.0
device.mfr: American Power Conversion
device.model: Back-UPS XS 1400U
device.serial: myserial1
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.productid: 0002
driver.parameter.serial: myserial1
driver.parameter.synchronous: auto
driver.parameter.vendorid: 051d
driver.version: 2.8.0
driver.version.data: APC HID 0.98
driver.version.internal: 0.47
driver.version.usb: libusb-1.0.26 (API: 0x1000109)
input.sensitivity: medium
input.transfer.high: 280
input.transfer.low: 155
input.transfer.reason: input voltage out of range
input.voltage: 240.0
input.voltage.nominal: 230
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.firmware: 926.T2 .I
ups.firmware.aux: T2
ups.load: 9
ups.mfr: American Power Conversion
ups.mfr.date: 2020/07/10
ups.model: Back-UPS XS 1400U
ups.productid: 0002
ups.realpower.nominal: 700
ups.serial: myserial1
ups.status: OL
ups.test.result: No test initiated
ups.timer.reboot: 0
ups.timer.shutdown: -1
ups.vendorid: 051d
  • OL means “On Line” (power is good).
  • You’ll see OB (On Battery) if you unplug the UPS.

Step 9 (Optional): Remote Monitoring

If you want multiple servers to shut down gracefully:

  1. Set MODE=netserver on the UPS host.
  2. Configure upsd.conf to listen on the LAN IP.
  3. On client machines, set MODE=netclient and point upsmon.conf at the UPS host.

Conclusion

With NUT configured, your Linux system can monitor your APC UPS, log events, and safely shut down when power runs out. This setup ensures your data and systems stay protected during outages — and you get peace of mind knowing your UPS isn’t just sitting there, but actively integrated into your infrastructure.