Link Search Menu Expand Document

Network UPS Tools (NUT)

This is how I used Network UPS Tools (NUT) for pfSense through USB and safely shut down my firewall (acting as a netserver) and remotely told my Proxmox host to also shut down.

Table of contents
  1. Getting started
    1. Prerequisites
  2. Install NUT
  3. Services / UPS / Settings
    1. General Settings
    2. Driver Settings
  4. Proxmox as netserver
    1. Runtimecal
  5. Fault finding
    1. upscmd
  6. Authors
  7. Acknowledgments

Getting started

Prerequisites

  • pfSense 2.4.5-RELEASE-p3 (amd64)
  • nut 2.7.4_7
  • Proxmox 6.7
  • PowerWalker VI 850 LCD

A quick and easy formula for calculating UPS runtime is, although not extremely precise:

t = V * Ah / W

PowerWalker VI 850 has a 12V 9Ah battery.

Using a powermeter, I have calculated that the power consumption of the equipment is about 110 W.

Maximum runtime would thus be 0.98 hours with a 110 W drain:

t = 12 * 9 / 110 = 0.98


Install NUT

Navigate to System > Packages and select Available Packages, scroll down to the NUT package and click Install.

In order to make it correctly pick up the usb connection, you will have to reboot the firewall. Go to Diagnostics and hit Reboot.


Services / UPS / Settings

General Settings

  • UPS Type: Local USB
  • UPS Name: PowerWalker_VI_850_LCD
  • Notifications: [v] Enable E-Mail notifications

Driver Settings

  • Driver: blazer

  • Extra Arguments to driver (optional):

desc="PowerWalker Line Interactive 850 LCD"
ignorelb
override.battery.charge.warning = 90
override.battery.charge.low = 85

The extra parameters override.battery.charge.warning = 90 and override.battery.charge.low = 85 will give a warning when the charge of the battery is below 90%. If the charge drops below 85%, it will send out shutdown commands.

The NUT package will create two users for you, admin and local-monitor:

more /usr/local/etc/nut/upsd.users
[admin]
password=437219huadshfe04
actions=set
instcmds=all

[local-monitor]
password=238ruhfE2849dfasdfaad
upsmon master

Proxmox as netserver

If you have your UPS connected to your Proxmox host through USB, do this to have the Proxmox host act as a UPS server, telling other NUT clients to shut down their hosts:

nano /etc/nut/nut.conf
MODE=netserver
nano /etc/nut/ups.conf

[powerwalker]
    driver = blazer_usb
    port = auto
    runtimecal = 486,100,1296,50
# Remove maxretry as it is not supported by this driver
#maxretry=3

Runtimecal

runtimecal = value,value,value,value

Parameter used in the (optional) runtime estimation. This takes two runtimes at different loads. Typically, this uses the runtime at full load and the runtime at half load. For instance, if your UPS has a rated runtime of 240 seconds at full load and 720 seconds at half load, you would enter

runtimecal = 240,100,720,50

PowerWalker 850 is rated for 480 watts.

Remember the formula t = V * Ah / W?

t = 12 * 9 / 480 = 0.225 hours, which is 13 minutes and 30 seconds (60 * 0.225), which is 13 * 60 = 810 seconds

t = 12 * 9 / 240 = 0.45 hours, which is 27 minutes (60 * 0.45), which is 27 * 60 = 1620 seconds

So I would have a runtimecal for this setup, and lets throw in a margin here of 0.6 and 0.8;

486,100,1296,50


Fault finding

upscmd

SSH in to your pfsense firewall, open up Shell (8):

Show the list of supported instant commands on our UPS named “PowerWalker_VI_850_LCD”:

upscmd -l PowerWalker_VI_850_LCD

Use a user which has sufficient permissions, instcmds=all, to send a command to the UPS:

upscmd -u admin -p 437219huadshfe04 PowerWalker_VI_850_LCD <command>

Authors

Mr. Johnson


Acknowledgments