Network UPS Tools

Example for Eaton 650i USB

Id

Reference

License

1

https://wiki.archlinux.org/title/Network_UPS_Tools

GNU Free Documentation License 1.3 or later 1

2

https://wiki.debian.org/nut

Unknown 2

Run as user

root

  1. create the jobs directories

    mkdir -p /home/jobs/scripts/by-user/nut
    chmod 700 /home/jobs/scripts/by-user/nut
    chown -R nut:nut /home/jobs/scripts/by-user/nut
    
  2. Install NUT

    apt-get install nut
    
  3. add the following to the UPS definitions file

    /etc/nut/nut.conf
    1MODE=standalone
    
  4. add the following to the UPS configuration file

    /etc/nut/ups.conf
    1[my_ups]
    2    pollonly
    3    driver = usbhid-ups
    4    port = auto
    5    vendorid = "0463"
    6    productid = "FFFF"
    7    pollfreq = 30
    8    desc = "Eaton UPS on my pc"
    
  5. add the following to the administrative user definitions file

    /etc/nut/upsd.users
    1[user]
    2    password = password
    3    upsmon master
    4    actions = SET
    5    instcmds = ALL
    
  6. add the following to the configuration file for the monitoring daemon

    /etc/nut/upsmon.conf
     1MONITOR my_ups@127.0.0.1 1 user password master
     2
     3NOTIFYFLAG ONBATT   SYSLOG+WALL+EXEC
     4NOTIFYFLAG LOWBATT  SYSLOG+WALL+EXEC
     5NOTIFYFLAG FSD      SYSLOG+WALL+EXEC
     6NOTIFYFLAG COMMOK   SYSLOG+WALL+EXEC
     7NOTIFYFLAG COMMBAD  SYSLOG+WALL+EXEC
     8NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC
     9NOTIFYFLAG REPLBATT SYSLOG+WALL+EXEC
    10NOTIFYFLAG NOCOMM   SYSLOG+WALL+EXEC
    11NOTIFYFLAG ONLINE   SYSLOG+WALL+EXEC
    12NOTIFYFLAG NOPARENT SYSLOG+WALL+EXEC
    13
    14NOTIFYCMD "/home/jobs/scripts/by-user/nut/ups_notify.sh"
    

    You can comment NOTIFYCMD or change it with a custom command. You can, for example, create a script like this script

    /home/jobs/scripts/by-user/nut/ups_notify.sh
    1#!/usr/bin/env bash
    2
    3echo "$*" | gotify
    
  7. restart all NUT services

    systemctl restart nut-driver.service
    systemctl restart nut-server.service
    systemctl restart nut-monitor.service
    
  8. remove the plug from the UPS and check if the NOTIFYCMD command is executed and if you get broadcast messages on the terminal, such as

    Broadcast message from ...
    UPS my_ups@127.0.0.1 on battery
    
  9. put the plug back in the UPS

Footnotes

1

Copyright (c) ArchWiki contributors

2

See https://wiki.debian.org/DebianWiki/LicencingTerms