Is anyone using or can recommend a free Internet down detector?
I'm running a poor mans detector (created a shell script) on my NAS since it's running 7x24.
It just logs ping failures to various IP's I put in the script.
It works, but is crude and loops through pinging every 30 seconds.
ping-test.sh
#!/bin/sh
# ping loopback, router (lan gateway), comcast cable modem lan1, comcast internet gateway, quad eight dns and quad one dns
# every 30 seconds, logging ping failures until the file /volume1/arkives/ping-test.stop exists to stop the script
#
# log start time of script in ISO 8601 format (to the second)
echo $(date -Iseconds) pingtest started >>/volume1/arkives/ping-test.log
# zero loop iteration counter
runnum=0
# loop until the file /volume1/arkives/ping-test.stop exists
until [ -a /volume1/arkives/ping-test.stop ]
do
# use ping options
# -nq Numeric (not hostname) and Quiet output
# -c1 Stop after sending 1 packet
# -W1 Wait up to 1 second for response
# log ping failure (exit status NE 0) time in ISO 8601 format (to the second)
ping -nq -c1 -W1 127.0.0.1; if [ $? -ne 0 ]; then echo $(date -Iseconds) pingfail 127.000.000.001 loopback >>/volume1/arkives/ping-test.log; fi
ping -nq -c1 -W1 192.168.1.1; if [ $? -ne 0 ]; then echo $(date -Iseconds) pingfail 192.168.001.001 router >>/volume1/arkives/ping-test.log; fi
ping -nq -c1 -W1 10.0.0.1; if [ $? -ne 0 ]; then echo $(date -Iseconds) pingfail 010.000.000.001 cable modem lan1 >>/volume1/arkives/ping-test.log; fi
ping -nq -c1 -W1 x.x.x.x; if [ $? -ne 0 ]; then echo $(date -Iseconds) pingfail xxx.xxx.xxx.xxx comcast internet gateway >>/volume1/arkives/ping-test.log; fi
ping -nq -c1 -W1 8.8.8.8; if [ $? -ne 0 ]; then echo $(date -Iseconds) pingfail 008.008.008.008 quad eight dns >>/volume1/arkives/ping-test.log; fi
ping -nq -c1 -W1 1.1.1.1; if [ $? -ne 0 ]; then echo $(date -Iseconds) pingfail 001.001.001.001 quad one dns >>/volume1/arkives/ping-test.log; fi
# wait 30 seconds, then increment loop iteration counter
sleep 30; ((runnum += 1))
# log a message it's still running about every hour (runnum == 120)
if ((runnum == 120)); then runnum=0; echo $(date -Iseconds) pingtest running >>/volume1/arkives/ping-test.log; fi
done
# log stop time of script in ISO 8601 format (to the second)
echo $(date -Iseconds) pingtest stopped >>/volume1/arkives/ping-test.log
ping-test.log
ping lo, router (lan gateway), cable modem lan1, inet gateway, quad eight dns and quad one dns every 30 seconds
To stop ping-test, rename the file /volume1/arkives/ping-test.run to ping-test.stop
2023-09-23T10:20:35-07:00 pingtest started
2023-09-23T11:20:43-07:00 pingtest running
2023-09-23T12:20:50-07:00 pingtest running
2023-09-23T13:20:58-07:00 pingtest running
2023-09-23T14:21:06-07:00 pingtest running
2023-09-23T15:21:14-07:00 pingtest running
2023-09-23T16:21:22-07:00 pingtest running
2023-09-23T17:21:30-07:00 pingtest running
2023-09-23T18:21:38-07:00 pingtest running
2023-09-23T19:21:45-07:00 pingtest running
2023-09-23T20:21:53-07:00 pingtest running
2023-09-23T21:22:00-07:00 pingtest running
2023-09-23T22:22:08-07:00 pingtest running
2023-09-23T23:22:15-07:00 pingtest running
2023-09-24T00:22:23-07:00 pingtest running
2023-09-24T01:22:30-07:00 pingtest running
2023-09-24T02:22:38-07:00 pingtest running
2023-09-24T03:22:45-07:00 pingtest running
2023-09-24T04:22:51-07:00 pingtest running
2023-09-24T05:22:57-07:00 pingtest running
2023-09-24T06:23:03-07:00 pingtest running
2023-09-24T07:23:08-07:00 pingtest running
2023-09-24T08:23:14-07:00 pingtest running
2023-09-24T09:23:20-07:00 pingtest running
2023-09-24T10:23:26-07:00 pingtest running
2023-09-24T11:23:33-07:00 pingtest running
2023-09-24T12:23:39-07:00 pingtest running
2023-09-24T13:23:45-07:00 pingtest running
2023-09-24T14:23:51-07:00 pingtest running
2023-09-24T15:23:58-07:00 pingtest running
2023-09-24T16:24:05-07:00 pingtest running


