Heiko L.
2014-Sep-03 13:38 UTC
[Nut-upsuser] howto force shutdown if nut-snmp Communications lost
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
Charles Lepple
2014-Sep-04 02:51 UTC
[Nut-upsuser] howto force shutdown if nut-snmp Communications lost
On Sep 3, 2014, at 9:38 AM, Heiko L. <HL at fh-lausitz.de> wrote:> Howto force shutdown if nut-snmp Communications lost? > > My 1. suggestion was option DEADTIME, but seem to be information only. (s. below)DEADTIME expiration is a critical condition if the UPS is on battery when comms are lost, otherwise you are correct, it is only informative. What about a NOTIFYCMD script that checks for COMMBAD or NOCOMM? (passed in $NOTIFYTYPE) You will also need to set the EXEC flag on that event. -- Charles Lepple clepple at gmail
Heiko L.
2014-Dec-30 21:56 UTC
[Nut-upsuser] howto force shutdown if nut-snmp Communications lost
>> Howto force shutdown if nut-snmp Communications lost? >> >> My 1. suggestion was option DEADTIME, but seem to be information only. (s. below) > > DEADTIME expiration is a critical condition if the UPS is on battery when comms are lost, otherwise you are correct, it is only > informative. > > What about a NOTIFYCMD script that checks for COMMBAD or NOCOMM? (passed in $NOTIFYTYPE) You will also need to set the EXEC > flag on that event.Thanks for you answer. NOTIFYCMD NOCOMM works. but i found any problems: Problem: - nut send NOCOMM, but ups not reachable if switch rebooted - nut configured 2 ups, but nut send NOCOMM if 1 ups down Iam written 2 tools [1][2] Details and variants see [3] Infos are welcome. regards Heiko [1] http://www2.fh-lausitz.de/launic/comp/misc/ups/nut.notifycmd.sh [2] http://www2.fh-lausitz.de/launic/comp/misc/ups/nut.pingups.sh [3] http://www2.fh-lausitz.de/launic/comp/misc/ups/141230.nut.snmp.comm_lost.variants.txt
Maybe Matching Threads
- howto force shutdown if nut-snmp Communications lost
- problem with mailing (nut 2.4.1 and a powermust650 -> megatec_usb)
- Apple Mac slave
- battery not installed, but battery still 100% and NUT 2.7.2-4 does not catch this and report a error
- Keep on losing communication: Raspberry Pi, CyberPower PR1500LCD