• Edit
  • Delete

Ubuntu Nut UPS (with Eaton 3s)

Nut / UPS

https://srackham.wordpress.com/2013/02/27/configuring-nut-for-the-eaton-3s-ups-on-ubuntu-linux/

https://networkupstools.org/docs/man/usbhid-ups.html

https://networkupstools.org/stable-hcl.html

Status Values

https://networkupstools.org/docs/man/genericups.html

  • OL - On line (no power failure) (opposite of OB - on battery)
  • LB - Low battery
  • SD - Shutdown load
  • CP - Cable power (must be present for cable to have valid reading)
  • CTS - Clear to Send. Received from the UPS.
  • RTS - Ready to Send. Sent by the PC.
  • DCD - Data Carrier Detect. Received from the UPS.
  • RNG - Ring indicate. Received from the UPS.
  • DTR - Data Terminal Ready. Sent by the PC.
  • ST - Send a BREAK on the transmit data line

A "-" in front of a signal name (like -RNG) means that the indicated condition is signaled with an active low signal. For example, [LB=-RNG] means the battery is low when the ring indicate line goes low, and that the battery is OK when that line is held high.

Ansible Installation

  • ansible-role -H myserver -i "myserver:2222," -e '{"nut_ups":{"name":"eaton3s","driver":"usbhid-ups","port":"auto","description":"EATON UPS"}}' nut-ups

Installation

  • apt-get install nut

  • lsusb

    • 0463:ffff MGE UPS Systems UPS

  • vi /etc/default/nut

    • START_UPSD=yes
      UPSD_OPTIONS=""
      START_UPSMON=yes
      UPSMON_OPTIONS=""
  • vi /etc/nut/ups.conf
    • https://networkupstools.org/docs/man/ups.conf.html
    • [eaton3s]
              driver=usbhid-ups
              port=auto
              desc="EATON UPS"
              #offdelay=60         
              #ondelay=70
              # Power down the server at a higher battery charge level (40%) than default 20%
              # This should help with older, weaker batteries
              ignorelb = yes
              override.battery.charge.low = 40
      
      # !!! Comment out, invalid for Ubuntu 18.04:
      #maxretry = 3
  • vi /etc/nut/upsmon.conf
    • MONITOR eaton3s@localhost 1 monuser pass master
      SHUTDOWNCMD "/etc/nut/shutdown"
      
  • vi /etc/nut/nut.conf
    • MODE=standalone
  • vi /etc/nut/upsd.users
    • [monuser]
      password=pass
      upsmon master
  • vi /etc/nut/shutdown
    • #!/bin/bash
      
      # UPS didn't shutdown, so we wrote this script
      
      upsdrvctl stop
      upsdrvctl shutdown
      
      poweroff
  • chmod 750 /etc/nut/shutdown
  • chown root:nut /etc/nut/shutdown
  • Reboot

Test / Troubleshooting

  • Ubuntu 16.04 and older
    • service upsd status
    • service upsmon status
  • The commands above do not exist in Ubuntu 18.04. Instead?
    • service nut-driver status
    • service nut-server status
    • service nut-monitor status
  • lsusb
    • Bus 001 Device 004: ID 0463:ffff MGE UPS Systems UPS
  • upsc eaton3s
  • upsmon -c fsd
    • simulates a ups shutdown event, power down, upc cuts power, restarts

Problem: Nut Driver does not start

https://networkupstools.org/docs/man/usbhid-ups.html

  • upsc eaton3s
  • service nut-server status
  • service nut-server restart

Try manual start and look for errors

  • /sbin/upsdrvctl start

This in turn executes

  • /lib/nut/usbhid-ups -a eaton3s

 

Problem: Nut Driver does not start up correctly on reboot

  • vi /etc/rc.local
    • #!/bin/sh -e
      #
      # rc.local
      #
      # This script is executed at the end of each multiuser runlevel.
      # Make sure that the script will "exit 0" on success or any other
      # value on error.
      
      # Sometime UPS driver does not start up correctly
      sleep 300
      service nut-driver restart
      
      exit 0

Still occasional problems, ups usb device not found

Try usb reset... (did not work)

  • lspci | grep XHCI | cut -d' ' -f1
    • 00:10.0
  • echo -n "0000:00:10.0" | tee /sys/bus/pci/drivers/xhci_hcd/unbind
  • echo -n "0000:00:10.0" | tee /sys/bus/pci/drivers/xhci_hcd/bind
  • lspci | grep EHCI | cut -d' ' -f1
    • 00:12.0

  • echo -n "0000:00:12.0" | tee /sys/bus/pci/drivers/ehci-pci/unbind

  • echo -n "0000:00:12.0" | tee /sys/bus/pci/drivers/ehci-pci/bind

---

https://github.com/networkupstools/nut/issues/515

  • service nut-driver restart;service nut-driver status
  • lsusb -v
    • Bus 001 Device 004: ID 0463:ffff MGE UPS Systems UPS
  • /lib/nut/usbhid-ups -a eaton3s -DDD
  • /lib/nut/usbhid-ups -a eaton3s -DDD -x explore -x vendorid=0x0463

Cron Job

  • vi /etc/cron.d/nutups
    • # check nut ups driver and force reload if failure
      */5 *     * * *     root  upsc eaton3s ups.status > /dev/null 2>&1; if [ $? != 0 ]; then echo "UPS driver connection failed, trying restart..." >&2; systemctl restart nut-driver; fi 
  • chmod 755 /etc/cron.d/nutups
  • upsc eaton3s ups.status > /dev/null 2>&1; if [ $? != 0 ]; then echo "UPS driver connection failed, trying restart..." >&2; systemctl restart nut-driver; fi

Alternative Hardware

BlueWalker PowerWalker VI 600 SCL

https://thomas-leister.de/powerwalker-ups-debian-stretch/