This is an old revision of the document!
APC UPS Devices
Install the required packages:
apt install apcupsd apcupsd-cgi
Edit the conf file
nano /etc/apcupsd/apcupsd.conf:
UPSCABLE usb UPSTYPE usb #DEVICE /dev/ttyS0 POLLTIME 60 BATTERYLEVEL 10 MINUTES 3
Restart the UPS monitoring service:
systemctl restart apcupsd.service
Check /var/log/syslog for errors and check communication with:
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 desc = "Back-UPS BX750MI" override.battery.charge.low = 50
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 mge@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
Add this to the script.
Set the permissions of the following files.
cd /etc/nut 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
Now edit /etc/nut/nut.conf
nano /etc/nut/nut.conf
Change the mode line
MODE=standalone
Now restart the UPS monitoring services.
systemctl restart nut-server.service systemctl restart nut-monitor.service
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).
