User Tools

Site Tools


technical:24.04_ups_setup_with_nut

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
technical:24.04_ups_setup_with_nut [2026/01/05 23:22] mark_scottworld.nettechnical:24.04_ups_setup_with_nut [2026/01/14 17:27] (current) mark_scottworld.net
Line 1: Line 1:
-APC UPS Devices+==== APC UPS Devices ====
  
 Install the required packages: Install the required packages:
Line 23: Line 23:
  
   apcaccess   apcaccess
 +  
 +NOTE: Currently this package is old and produces constant errors in the events log. - it may be better to use NUT
 +
 +==== Using NUT for UPS ====
 +
 +Install the required packages:
 +
 +  apt install nut
 +  
 +Edit the ups.conf file.
 +
 +  nano /etc/nut/ups.conf
 +  
 +Add the following at the bottom of the file.
 +
 + [apc]
 + driver = usbhid-ups
 + port = auto
 + #cable = 940-0095B
 + desc = "Back-UPS BX750MI"
 + #override.battery.charge.low = 50
 + #onlinedischarge_calibration = set
 + pollonly
 + lbrb_log_delay_sec = 3
 + lbrb_log_delay_without_calibrating
 +
 +Edit /etc/nut/upsd.conf
 +
 +  nano /etc/nut/upsd.conf
 +  
 +Uncomment and modify the following lines.
 +
 +  MAXAGE 30
 +  LISTEN 127.0.0.1 3493
 +  MAXCONN 10
 +  
 +Edit the file  /etc/nut/upsd.users
 +
 +  nano /etc/nut/upsd.users
 +
 +Add the following to the end of the file.
 +  
 +  [upsuser]
 +  password=<secret>  <-- This can be anything (make up some secret)
 +  upsmon master
 +  
 +Edit /etc/nut/upsmon.conf
 +
 +  nano /etc/nut/upsmon.conf
 +
 +Uncomment and set the following lines...
 +
 +
 +  MONITOR apc@localhost 1 upsuser <secret> master
 +  NOTIFYCMD /etc/nut/notify-email
 +  SHUTDOWNCMD "/sbin/shutdown -P +0"
 +  DEADTIME 20
 +  NOTIFYFLAG ONLINE     SYSLOG+WALL+EXEC
 +  NOTIFYFLAG ONBATT     SYSLOG+WALL+EXEC
 +  NOTIFYFLAG LOWBATT    SYSLOG+WALL+EXEC
 +  NOTIFYFLAG FSD        SYSLOG+WALL+EXEC
 +  NOTIFYFLAG COMMOK     SYSLOG+WALL+EXEC
 +  NOTIFYFLAG COMMBAD    SYSLOG+WALL+EXEC
 +  NOTIFYFLAG SHUTDOWN   SYSLOG+WALL+EXEC
 +  NOTIFYFLAG REPLBATT   SYSLOG+WALL+EXEC
 +  NOTIFYFLAG NOCOMM     SYSLOG+WALL+EXEC
 +  NOTIFYFLAG NOPARENT   SYSLOG+WALL+EXEC
 +
 +Now create a script to send email notifications /etc/nut/notify-email
 +
 +  nano /etc/nut/notify-email
 +  
 +In /etc/nut/notify-email add:  (you will need to prefix the file with a bash shell)
 +
 +<code>
 +#!/bin/s<remove>h characters (this line is messed due to wiki not allowing them)
 +SUBJECT="`hostname`: Power Event"
 +FROM_ADDR="root@<host>.net"
 +FROM_NAME="UPS"
 +TO="<recepient>"
 +echo "Subject: $SUBJECT\n\n$*" | sendmail -f "$FROM_ADDR" -F "$FROM_NAME" "$TO"
 +</code>
 +
 +Set the necessary permissions:
 +
 +<code>
 +chown root:nut ups.conf upsd.conf upsd.users upsmon.conf notify-email
 +chmod 0640 ups.conf upsd.conf upsd.users upsmon.conf
 +chmod 0750 notify-email
 +</code>
 +
 +Change the following in /etc/nut/nut.conf:
 +
 +  MODE=standalone
 +
 +Restart the UPS monitoring service:
 +
 +<code>
 +systemctl restart nut-server.service
 +systemctl restart nut-monitor.service
 +</code>
 +
 +Check /var/log/syslog for errors and check communication with:
 +
 +  upsc apc@localhost
 +  
 +(You may need to reboot before the USB is allowed to talk to the UPS).   
 +
technical/24.04_ups_setup_with_nut.1767651732.txt.gz · Last modified: by mark_scottworld.net

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki