Previously, I’ve written about using a Raspberry Pi with Network UPS Tools (NUT) to manage multiple computers with one UPS device.
I recently decided to use a second UPS as I started building and configuring a separate Proxmox machine that has been repurposed from my former daily driver computer. My second UPS is a APC XS1300G that is about 5 years old. Originally, protected my entertainment equipment which used to be very elaborate, but now that has been mostly unused for the time being. I also wanted to learn how to manage multiple UPSs in NUT as well.
Adding the Second UPS
My original configuration in the /etc/nut/ups.conf is as follows:
[ups] driver = usbhid-ups port = auto desc = "CyberPower CP825LCD" pollinterval = 15
As you can see the port was set to auto. This would conflict if I wanted to add a second UPS.
After some frustration, it turns out you just need to specify the vendorid and the productid for all the UPS devices you want to manage. Here’s my original UPS with those codes:
[ups] driver = usbhid-ups port = auto desc = "CyberPower CP825LCD" vendorid = 0764 productid = 0501 pollinterval = 15
To add my second UPS, I’ve added the below configuration. I’ve also included the serial number (partially redacted to protect the innocent) for additional specificity for NUT. My original UPS device, the CP825, does not display the serial number.
[apcXS1300G] driver = usbhid-ups port = auto desc = "APC Back-UPS 1300G" serial = 3BXXXXXXXX54 vendorid = 051d productid = 0002 pollinterval = 15
You’ll need to restart nut in order for the new UPS to appear. Run sudo systemctl restart nut-server. Give it a moment to rediscover all the UPSs.
Once that is done, when I run upsc apcXS1300G, I get the following result:
pi@worker11811-pi:/etc/nut $ upsc apcXS1300G Init SSL without certificate database battery.charge: 100 battery.charge.low: 10 battery.charge.warning: 50 battery.date: 2001/09/25 battery.mfr.date: 2016/04/21 battery.runtime: 12960 battery.runtime.low: 120 battery.type: PbAc battery.voltage: 27.2 battery.voltage.nominal: 24.0 device.mfr: American Power Conversion device.model: Back-UPS XS 1300G device.serial: 3BXXXXXXXX54 device.type: ups driver.name: usbhid-ups driver.parameter.pollfreq: 30 driver.parameter.pollinterval: 15 driver.parameter.port: auto driver.parameter.productid: 0002 driver.parameter.serial: 3BXXXXXXXX54 driver.parameter.synchronous: no driver.parameter.vendorid: 051d driver.version: 2.7.4 driver.version.data: APC HID 0.96 driver.version.internal: 0.41 input.sensitivity: high input.transfer.high: 136 input.transfer.low: 88 input.voltage: 124.0 input.voltage.nominal: 120 ups.beeper.status: disabled ups.delay.shutdown: 20 ups.firmware: 864.L8 .D ups.firmware.aux: L8 ups.load: 0 ups.mfr: American Power Conversion ups.mfr.date: 2016/04/21 ups.model: Back-UPS XS 1300G ups.productid: 0002 ups.realpower.nominal: 780 ups.serial: 3B1616X11054 ups.status: OL ups.test.result: No test initiated ups.timer.reboot: 0 ups.timer.shutdown: -1 ups.vendorid: 051d
Monitoring the Second UPS
Next, we need to add the second UPS to be monitored by NUT in the /etc/nut/upsmon.conf file. Look for your original UPS monitor line which will look something like this:
MONITOR ups@localhost 1 username password master
Don’t forget that the username and password are set in the /etc/nut/upsd.users file.
Now you’ll add a second line, but change a few of the settings:
MONITOR ups@localhost 1 username password master
MONITOR apcXS1300G@localhost 2 username password slave
Here I’ve added the UPS name that was added to the ups.conf, “apcXS1300G”, sequentially increased the number to “2”, and then changed “master” to “slave”.
After adding that, you’ll want to restart the monitor server with sudo systemctl restart nut-monitor as well as the driver. This will again restart the connections to both UPS devices and should show they are now established.
sudo systemctl restart nut-monitor
sudo upsdrvctl stop
sudo upsdrvctl start
Head on over to your browser and type in your upsstates.cgi path. For me, it is http://192.168.1.3:8080/cgi-bin/nut/upsstats.cgi becuase my PiHole installation uses Litehttp, so I had to configure Apache to use the 8080 port. If you are using default NUT configuration, no need to enter a port. And you’ll see the following:
Now you can connect any of your devices to be monitored by the NUT to utilize the new UPS.
Overtime, I expect to switch all my homelab devices to the APC XS 1300G as it handles more load and capacity. So if you do get to a point where your homelab requires more than one UPS device, this is the way to add a second UPS to NUT.