[Nut-upsuser] howto force shutdown if nut-snmp Communications lost

Heiko L. HL at fh-lausitz.de
Wed Sep 3 13:38:25 UTC 2014


Hallo,

I have one ups with snmp and any ups without snmp.
Shutdown works while network online.
But some batteries are empty, so that the communication break early.

Howto force shutdown if nut-snmp Communications lost?

My 1. suggestion was option DEADTIME, but seem to be information only. (s. below)

Any suggestions?
The last way would be a ugly cronjob (like: ping || shutdown).

regards Heiko



------------------------------------------------------
- script simulate network failure
defaultrouter=`netstat -rn | grep "^0.0" | awk '{print $2}'`
waitinit=10
waitdownup=600
syslog=/var/log/syslog
eth=eth0
echo "defaultrouter=$defaultrouter syslog=$syslog eth=$eth waitinit=$waitinit waitdownup=$waitdownup"
(sleep $waitinit;
echo "`date +%m\ %d\ %H:%M:%S` exec ifconfig $eth down"; ifconfig $eth down;
echo "`date +%m\ %d\ %H:%M:%S` wait $waitdownup s." ;sleep $waitdownup;
echo "`date +%m\ %d\ %H:%M:%S` exec ifconfig $eth up"; ifconfig $eth up; route add default gw $defaultrouter;
) &
tail -f $syslog | egrep -v "CRON|snmp_ups_walk"
## send ^C if done


------------------------------------------------------
- test1
  - DEADTIME=90, NOCOMMWARNTIME=130
  - nut-2.2 nut-2.4

testvm:~# grep "^[A-Z]" /etc/nut/upsmon.conf
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +0"
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 90
POWERDOWNFLAG /etc/killpower
RBWARNTIME 43200
NOCOMMWARNTIME 130
FINALDELAY 5
MONITOR usv2-216 at localhost 1 upsmon topsecret master


09 03 14:40:59 exec ifconfig eth0 down
09 03 14:40:59 wait 600 s.
Sep  3 14:41:07 testvm last message repeated 3 times
Sep  3 14:41:07 testvm upsd[6800]: Data for UPS [usv2-216] is stale - check driver
Sep  3 14:41:09 testvm upsmon[6803]: Poll UPS [usv2-216 at localhost] failed - Data stale
Sep  3 14:41:09 testvm upsmon[6803]: Communications with UPS usv2-216 at localhost lost
Sep  3 14:41:14 testvm upsmon[6803]: Poll UPS [usv2-216 at localhost] failed - Data stale
Sep  3 14:43:14 testvm upsmon[6803]: UPS usv2-216 at localhost is unavailable
Sep  3 14:43:19 testvm upsmon[6803]: Poll UPS [usv2-216 at localhost] failed - Data stale
Sep  3 14:43:49 testvm last message repeated 6 times
Sep  3 14:44:49 testvm last message repeated 12 times
Sep  3 14:45:29 testvm last message repeated 8 times
Sep  3 14:45:29 testvm upsmon[6803]: UPS usv2-216 at localhost is unavailable
Sep  3 14:45:34 testvm upsmon[6803]: Poll UPS [usv2-216 at localhost] failed - Data stale
Sep  3 14:46:09 testvm last message repeated 7 times
Sep  3 14:47:14 testvm last message repeated 13 times
Sep  3 14:47:44 testvm last message repeated 6 times
Sep  3 14:47:44 testvm upsmon[6803]: UPS usv2-216 at localhost is unavailable
Sep  3 14:47:49 testvm upsmon[6803]: Poll UPS [usv2-216 at localhost] failed - Data stale
Sep  3 14:48:19 testvm last message repeated 6 times
Sep  3 14:49:19 testvm last message repeated 12 times
Sep  3 14:49:59 testvm last message repeated 8 times
Sep  3 14:49:59 testvm upsmon[6803]: UPS usv2-216 at localhost is unavailable
Sep  3 14:50:04 testvm upsmon[6803]: Poll UPS [usv2-216 at localhost] failed - Data stale
Sep  3 14:50:39 testvm last message repeated 7 times
09 03 14:50:59 exec ifconfig eth0 up
Sep  3 14:51:09 testvm last message repeated 6 times
Sep  3 14:51:14 testvm upsd[6800]: UPS [usv2-216] data is no longer stale
Sep  3 14:51:14 testvm last message repeated 2 times
Sep  3 14:51:14 testvm upsmon[6803]: Communications with UPS usv2-216 at localhost established

  - DEADTIME approx. 14:43

------------------------------------------------------
[25] http://www.networkupstools.org/docs/man/upsmon.conf.html
   nut man upsmon.conf - Configuration for Network UPS Tools upsmon
   DEADTIME seconds






More information about the Nut-upsuser mailing list