FreeNAS Install And Configure APC UPS For Power Management

I have an APC SUA1500i smart ups, and want to configure power option from my FreeNAS using this ups. How can I install an appropriate APC UPS USB driver on my FreeNAS server, and use it to control power options?

[donotprint]
Tutorial details
Difficulty Easy (rss)
Root privileges Yes
Requirements FreeNAS
Time 5m
[/donotprint]FreeNAS is nothing but a FOSS network-attached storage (NAS) system based on FreeBSD Unix and the OpenZFS file system. It comes with a dedicated management web interface for managing and configuring your NAS box. In this tutorial you will learn how to configure the APC (or any other supported brand) UPS service then start it in FreeNAS to protect your server from power failures. This tutorial shows how to configure and use UPS on a FreeNAS based server.

ADVERTISEMENTS

How To FreeNAS Install And Configure APC UPS For Power Management

An uninterruptible power supply/uninterruptible power source (UPS) is an electrical apparatus that provides emergency power to a load when the input power source, typically mains power, fails. A UPS is useful start a standby power source such as generator or properly shut down the FreeNAS box.

FreeNAS and NUT

FreeNAS comes with NUT (Network UPS Tools) software to provide support for Power Devices such as UPS.

Configuration

First connect the APC ups to your FreeNAS based server using the serial or USB port the UPS is plugged into.

Finding out the APC USB port name

Login to your FreeNAS server using ssh and type the following command:
dmesg | grep -i --color 'american power conversion'
Or
dmesg | grep -i usbus | grep -i --color 'american power conversion'
Sample outputs:

Fig.01: FreeNAS/FreeBSD Find Out APC UPS USB Device Name

Fig.01: FreeNAS/FreeBSD Find Out APC UPS USB Device Name

How do I configure UPS monitoring service on FreeNAS server?

To configure the UPS service login to your FreeNAS web-gui. Navigate as follows:

Services > Control Services
Fig.02: FreeNAS UPS service

Fig.02: FreeNAS UPS service

You need to set the following options:
FreeNAS Install And Configure APC UPS For Power Management Options

Fig.03 FreeNAS UPS service configuration options

  1. Set UPS Mode to Master.
  2. Set Identifier to ups.
  3. Set Driver as per your USP model. In this example, I set it to “APC ups 2 Back-UPS USB USB (usbhid-ups)“.
  4. Set Port to /dev/ugen0.3 (again set this as per your setup).
  5. Set Shutdown mode to “UPS reaches low battery“.
  6. Set Monitor password “passwordHere” (again replace passwordHere with actual password).
  7. Set email to “you@nixcraft.com” (replace you@nixcraft.com with actual email id).
  8. Finally click on “Ok” button to save changes.

Next make sure you start UPS service on boot by clicking “Start on boot” and Start Now button from Services right panel:

Fig.04: Starting UPS service on FreeNAS

Fig.04: Starting UPS service on FreeNAS

How do I test UPS connectivity and configuration on FreeNAS?

Login using ssh and simply type the following command to poll the status of a UPS server on FreeNAS:

upsc ups@localhost

Sample outputs:

Gif.01: upsc demo on FreeNAS

Gif.01: upsc demo on FreeNAS

And, there you have it, the APC ups installed and working correctly on the latest version of FreeNAS.

References
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
11 comments… add one
  • Jalal Hajigholamali Oct 14, 2015 @ 5:22

    Hi,
    Very useful article…
    Thanks a lot..

  • Jack Oct 22, 2015 @ 20:59

    Yup. Agreed. Very useful article. Quick question on step 5 & 6 there. For monitor user, do you have to create a new user in FreeNAS or it is an existing user in FreeNAS group? For step 6, do we use the root password or we need to create a brand new password for it?
    Thanks,
    jack

    • 🐧 Vivek Gite Oct 23, 2015 @ 6:03

      You type a new password in step #6. No need to create user in FreeNAS for #5.

  • John H Nov 20, 2015 @ 14:22

    Have you tested this? Does it sync, then issue a shutdown before all power is lost?

    • Chris Dec 1, 2015 @ 3:35

      There is another shutdown mode called “UPS goes on battery”. I think it will be straightforward to test under that mode, set it up and then pull the power cable of the UPS off to simulate electricity outage.

  • Chris Dec 17, 2015 @ 13:04

    Is there any guide to how to select the correct driver?

    I have an APC 950VA (BX950U-MS) but I have no idea which would be the correct driver out of the many APC ones, so I selected the one that you used above.

  • Kevin Apr 9, 2016 @ 21:09

    I have an APC BN600G. I don’t see a driver listed for it. How do I know which driver to use?

    • retro Apr 8, 2017 @ 19:09

      You can select generic USB PAC driver from drop down menu. It worked for me and I hope it will work for you too.

  • jpvalencia Oct 6, 2017 @ 1:24

    With this tutorial works for APC BE600M1, thanks a lot.

  • msbxa Aug 3, 2020 @ 6:42

    It’s vey clear how to Finding out the APC USB port name with command
    dmesg | grep -i --color 'american power conversion'
    Or
    dmesg | grep -i usbus | grep -i --color 'american power conversion'
    ut what command to use to Finding out the APC serial port name? because the above command only works with if you connect USB cable. Thanks

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.