For storage in my homelab, I use TrueNAS. Additionally, I run a couple of apps on top of it as jails. For over a year, I’ve been using an uninterruptible power supply (UPS) to protect my TrueNAS from possible data loss in case of a power failure. What I’ve been missing throughout that time are the monitoring and management tools to shut down everything gracefully when the battery of the UPS runs low. In the event of a power outage lasting longer than 30 minutes, the battery would run out of juice. Everything attached to the UPS would be powered off immediately, and data loss might occur. Luckily I live in an area where power outages rarely happen. I also have backups I could restore if my TrueNAS data gets corrupted. Still, doing this right and configuring Network UPS Tools (NUT) to orchestrate shutdowns has been on my to-do list for way too long. It’s time to tackle the issue!

As always, I’ll only mention settings deviating from the defaults.


My server rack contains the following hardware.

  1. OPNsense firewall and router
  2. TrueNAS storage and jail apps
  3. Mikrotik CRS328-24P-4S+RM core switch running SwOS
  4. CyberPower PR750ERT2U UPS
  5. ISP modem

Of the above, only OPNsense and TrueNAS are susceptible to data corruption in case of power loss. If a shutdown due to low battery power is required, I want to shut down TrueNAS first. After, OPNsense shuts down. To achieve this with NUT, I configure OPNsense as NUT master and TrueNAS as NUT slave. Only one master must exist. However, multiple slaves may exist.

CyberPower PR750ERT2U

The CyberPower PR750ERT2U has about everything I’d ever want from a UPS.

  • HID-compliant USB port to connect OPNsense
  • Fanless operation in utility mode. It isn’t apparent from the specifications, but the CyberPower support kindly provided me with this information
  • 750VA capacity allowing me to add another server
  • Pure sine wave output
  • Line-interactive topology
  • Energy-saving capabilities

Initially, I looked at similar used APC units on eBay. At the time, I couldn’t find any good deals on eBay meeting all of the requirements above. I then found the CyberPower unit selling new for under $400 and grabbed one. I’ve been a happy CyberPower customer ever since. To be clear, I don’t affiliate with CyberPower.

NUT on OPNsense

NUT Service Configuration

To configure the NUT service on OPNsense, we do the following.

  1. Install the os-nut plugin under System Firmware Plugins
  2. Refresh the browser and enable the USB HID driver under Services Nut Configuration UPS Type USBHID-Driver
  3. Reboot OPNsense
  4. Connect the UPS to OPNsense via USB
  5. Set the Monitor Password and Admin Password under Services Nut Configuration Nut Account Settings
  6. Set a Name (e.g., cyberpower) and Enable Nut under Services Nut Configuration General Settings General Nut Settings

We should see the data of the UPS under Services Nut Diagnostics.

battery.charge: 100
battery.charge.low: 0
battery.charge.warning: 35 CPS
battery.runtime: 5020
battery.runtime.low: 300
battery.type: PbAcid
battery.voltage: 0.6
battery.voltage.nominal: 22
device.mfr: CPS
device.model: PR750ERT2U
device.serial: XXXXXXXXXXXX
device.type: ups usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.synchronous: no
driver.version: 2.7.4 CyberPower HID 0.4
driver.version.internal: 0.41
input.voltage: 235.0
input.voltage.nominal: 230
output.voltage: 253.0
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.delay.start: 30
ups.load: 17
ups.mfr: CPS
ups.model: PR750ERT2U
ups.productid: 0601
ups.realpower.nominal: 750
ups.serial: XXXXXXXXXXXX
ups.status: OL
ups.test.result: No test initiated
ups.timer.shutdown: 0
ups.timer.start: 0
ups.vendorid: 0764

Port Forward

To allow TrueNAS to communicate with the NUT server on OPNsense, we add the following port forward under Firewall NAT Port Forward. I assume that TrueNAS is part of the LAN network.

SourceTrueNAS IP
DestinationLAN address
Destination port rangefrom 3493 to 3493
Redirect target IP127.0.0.1
Redirect target port3493
DescriptionRedirect NUT traffic to OPNsense

To see if it works, we SSH into TrueNAS and run the following to retrieve the UPS status from OPNsense.


Screenshot of TrueNAS NUT settings

Set the following options under Services UPS Configure.

General Options
IdentifierThe Name we earlier set in OPNsense, e.g., cyberpower
UPS ModeSlave
Remote Host<IP or hostname of OPNsense>
Remote Port3493
Shutdown ModeUPS reaches low battery
Shutdown Command/sbin/poweroff
Monitor Usermonuser
Monitor PasswordThe Monitor Password we earlier set in OPNsense

Clicking Save returns us to the Services menu. We need to enable the UPS service and check Start Automatically to start the service at boot time.

Screenshot of TrueNAS Services settings


We could disconnect the UPS from power and let the battery drain until the UPS reaches low battery status. At some point, it’s probably a good idea to do. But repeatedly doing that unnecessarily wears down the battery. Another way is to run the Force Shut Down command. SSH into the NUT master (OPNsense) and run the following.

upsmon -c fsd

If we configured everything correctly, TrueNAS and OPNsense shut down.