Network UPS Tools
Example for Eaton 650i USB
Id |
Reference |
License |
1 |
GNU Free Documentation License 1.3 or later 1 |
|
2 |
Unknown 2 |
Run as user |
|
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
Install NUT
apt-get install nut
add the following to the
UPS definitions file
/etc/nut/nut.conf1MODE=standalone
add the following to the
UPS configuration file
/etc/nut/ups.conf1[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"
add the following to the
administrative user definitions file
/etc/nut/upsd.users1[user] 2 password = password 3 upsmon master 4 actions = SET 5 instcmds = ALL
add the following to the
configuration file for the monitoring daemon
/etc/nut/upsmon.conf1MONITOR 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 thisscript
/home/jobs/scripts/by-user/nut/ups_notify.sh1#!/usr/bin/env bash 2 3echo "$*" | gotify
restart all NUT services
systemctl restart nut-driver.service systemctl restart nut-server.service systemctl restart nut-monitor.service
remove the plug from the UPS and check if the
NOTIFYCMD
command is executed and if you get broadcast messages on the terminal, such asBroadcast message from ... UPS my_ups@127.0.0.1 on battery
put the plug back in the UPS
Footnotes