[Nut-upsuser] Shutdown when both (all) UPS on battery / low battery

Rafał Oleszek r.oleszek at wasko.pl
Tue Jan 21 13:05:07 UTC 2014


> What do your configuration files look like? Setting MINSUPPLIES to 2 should work. You can run upsmon with a debug level of 3 or greater, and it will print the current and minimum "power value", which is what determines when to shut down.
>
> Also, if you don't want to wait for both UPSes to drain to the low battery state, you can set up a pair of dummy-ups drivers. I'm not sure how well that will work with 2.2.2, but since dummy-ups doesn't require hardware, you could build a newer version of NUT on another system, and configure it to only build the dummy-ups driver.
>
Thank you for your reply.
I tested configuration on live environment and on dummy-ups. I also 
built the newest NUT version, tested on dummy-ups and it didn't work 
with my config.
My config files:

upsmon.conf:

RUN_AS_USER root
MONITOR UPS_251 at localhost 2 monmaster password master
MONITOR UPS_252 at localhost 2 monmaster password master
MINSUPPLIES 2
SHUTDOWNCMD "/etc/ups/test"
NOTIFYCMD /usr/sbin/upssched
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 30
POWERDOWNFLAG /etc/killpower
NOTIFYFLAG ONLINE       SYSLOG+WALL+EXEC
NOTIFYFLAG ONBATT       SYSLOG+WALL+EXEC
NOTIFYFLAG LOWBATT      SYSLOG+WALL+EXEC
NOTIFYFLAG COMMOK       SYSLOG+WALL
NOTIFYFLAG COMMBAD      SYSLOG+WALL+EXEC
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5


upssched.conf:

CMDSCRIPT /usr/bin/upssched-cmd
PIPEFN /var/run/nut/upssched.pipe
LOCKFN /var/run/nut/upssched.lock
AT COMMBAD * EXECUTE upsgone
AT ONBATT * START-TIMER onbatt 30
AT LOWBATT * START-TIMER lowbatt 130
AT ONLINE * CANCEL-TIMER onbatt
AT ONLINE * CANCEL-TIMER lowbatt


/usr/bin/upssched-cmd:

#! /bin/sh
case $1 in
         upsgone)
                 #logger -t upssched-cmd "The UPS has been gone for awhile"
                 echo `date +%c` >> /etc/ups/asd.txt
                 ;;
         onbatt)
#               /etc/ups/onbatt.sh
                 echo `date +%c` onbatt >> /etc/ups/asd.txt
                 ;;
         lowbatt)
#               /etc/ups/lowbatt.sh
                 echo `date +%c` lowbatt >> /etc/ups/asd.txt
                 ;;
         *)
                 logger -t upssched-cmd "Unrecognized command: $1"
                 ;;
esac


-------------------------------------

Communication with my Delta UPS is OK.  It does not matter what value 
I'll put in MONITOR and MINSUPPLIES line. NUT not waiting for both UPS 
to start timer. If one of them goes OB or LB it start timer. Another 
thing is that that NUT can't cancel LB timer (but this is not important, 
I can change LB percent value on UPS and just shutdown environment later 
without timer).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2274 bytes
Desc: Kryptograficzna sygnatura S/MIME
URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20140121/2d65041a/attachment.bin>


More information about the Nut-upsuser mailing list