FreeNAS 9.3 UPS Monitoring

It’s always a good idea to have a battery backup for servers and desktops.

FreeNAS is capable of running the nut UPS monitoring service. This will allow other servers to monitor the UPS and shutdown on low battery.

FreeNAS

  1. Start by SSHing into your FreeNAS server

  2. Locate the UPS by executing usbconfig sudo usbconfig

    ugen0.1: <EHCI root HUB Intel> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
    ugen1.1: <EHCI root HUB Intel> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
    ugen0.2: <product 0x8008 vendor 0x8087> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
    ugen1.2: <product 0x8000 vendor 0x8087> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
    ugen0.3: <product 0x7000 vendor 0x0557> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (100mA)
    ugen0.4: <product 0x2419 vendor 0x0557> at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON (160mA)
    ugen1.3: <Ultra Fit SanDisk> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (224mA)
    ugen1.4: <CRDA103AF1 CP1000PFCLCD> at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (2mA)
    

    Copy the identifier. Mine is ugen1.4.

    For serial devices you’ll need to read this page. https://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/serial.html


  1. Log into FreeNAS and go to the “Services” tab

  2. Click on the wrench next to “UPS”

    • Select your UPS from the “Driver” drop down menu
    • Select the port your device is on
    • Select the shutdown mode
    • Set the monitor user/password
    • Check the box for “Remote Monitor” (this allows other servers to monitor the UPS)

  3. “OK”

  4. Turn on “UPS”

Nut Configuration

  1. Install nut apt-get install nut

  2. Edit the nut configuration to change the mode /etc/nut/nut.conf MODE=netclient

  3. Edit the monitor configuration /etc/nut/upsmon.conf

    Look for NOTIFYFLAG and append +EXEC to the ones you want.

    NOTIFYFLAG ONLINE       SYSLOG+WALL     
    NOTIFYFLAG ONBATT       SYSLOG+WALL+EXEC
    NOTIFYFLAG LOWBATT      SYSLOG+WALL+EXEC
    # NOTIFYFLAG FSD        SYSLOG+WALL
    # NOTIFYFLAG COMMOK     SYSLOG+WALL
    # NOTIFYFLAG COMMBAD    SYSLOG+WALL
    NOTIFYFLAG SHUTDOWN     SYSLOG+WALL+EXEC
    # NOTIFYFLAG REPLBATT   SYSLOG+WALL
    # NOTIFYFLAG NOCOMM     SYSLOG+WALL
    # NOTIFYFLAG NOPARENT   SYSLOG+WALL
    

    At the bottom add: MONITOR [email protected] 1 upsmon password slave

    Change the IP address to that of your FreeNAS server.

  4. Restart nut systemctl restart nut-monitor.service

  5. Test

    [email protected]:~# upsc [email protected]
    Init SSL without certificate database
    battery.charge: 100
    battery.charge.low: 10
    battery.charge.warning: 20
    battery.mfr.date: CPS
    battery.runtime: 1290
    battery.runtime.low: 300
    battery.type: PbAcid
    battery.voltage: 16.0
    battery.voltage.nominal: 24
    device.mfr: CP1000PFCLCD
    device.model: CRDA103*AF1
    device.serial: CPS
    device.type: ups
    driver.name: usbhid-ups
    driver.parameter.pollfreq: 30
    driver.parameter.pollinterval: 2
    driver.parameter.port: /dev/ugen1.4
    driver.version: 2.7.2
    driver.version.data: CyberPower HID 0.3
    driver.version.internal: 0.38
    input.transfer.high: 136
    input.transfer.low: 88
    input.voltage: 121.0
    input.voltage.nominal: 120
    output.voltage: 137.0
    ups.beeper.status: disabled
    ups.delay.shutdown: 20
    ups.delay.start: 30
    ups.load: 22
    ups.mfr: CP1000PFCLCD
    ups.model: CRDA103*AF1
    ups.productid: 0501
    ups.realpower.nominal: 600
    ups.serial: CPS
    ups.status: OL
    ups.test.result: No test initiated
    ups.timer.shutdown: -60
    ups.timer.start: -60
    ups.vendorid: 0764
    

You should also unplug the UPS for a few seconds to see if you get a notification in dmesg.

Comments