apt update
apt install nut-client
Make a backup of each config file before proceed e.g. copy ups.conf to ups.example.conf
upsmon.conf
RUN_AS_USER nutmon
MONITOR eaton@yourupsip 1 upsslave yourpassword2 slave
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +0"
NOTIFYCMD /usr/sbin/upssched
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG /etc/killpower
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
NOTIFYFLAG NOCOMM SYSLOG+WALL+EXEC
# NOTIFYFLAG NOPARENT SYSLOG+WALL
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5
nut.conf
MODE=netclient
upssched.conf
CMDSCRIPT /etc/nut/upssched/upssched-cmd
PIPEFN /etc/nut/upssched/upssched.pipe
LOCKFN /etc/nut/upssched/upssched.lock
AT ONBATT * START-TIMER onbatt 30
AT ONLINE * CANCEL-TIMER onbatt online
AT ONBATT * START-TIMER battshutdown 120
AT ONLINE * CANCEL-TIMER battshutdown online
AT LOWBATT * EXECUTE shutdowncritical
AT COMMBAT * START-TIMER commbad 30
AT COMMOK * CANCEL-TIMER commbad commok
AT NOCOMM * EXECUTE commbad
AT SHUTDOWN * EXECUTE powerdown
/etc/nut/upssched/upssched-cmd
#! /bin/sh
#
# This script should be called by upssched via the CMDSCRIPT directive.
#
# Here is a quick example to show how to handle a bunch of possible
# timer names with the help of the case structure.
#
# This script may be replaced with another program without harm.
#
# The first argument passed to your CMDSCRIPT is the name of the timer
# from your AT lines.
case $1 in
onbatt)
logger -t upssched-cmd "The UPS is on battery"
;;
battshutdown)
logger -t upssched-cmd "UPS on battery too long, initiate shutdown"
/sbin/upsmon -c fsd
;;
online)
logger -t upssched-cmd "The UPS is back online"
;;
shutdowncritical)
logger t upssched-cmd "UPS on battery critical, forced shutdown"
/usr/sbin/upsmon -c fsd
;;
upsgone)
logger -t upssched-cmd "The UPS has been gone for awhile"
;;
*)
logger -t upssched-cmd "Unrecognized command: $1"
;;
esac
useradd -r nutmon
usermod -g nut nutmon
mkdir /etc/nut/upssched
chown root:nut -R /etc/nut/upssched
chmod 750 /etc/nut/upssched/upssched-cmd