You want to check your internet connectivity. You need something to test your connection that day as you are having issues. I found a nice bash script to check internet uptime and tweaked it for us all to use with ease.
Sometimes you need to keep track of internet access. Just because you are a geek and would like to know or because you were having issues with your hoster like me and want to test.
I found an interesting script you can run on your Mac by executing a bash script. I adjusted it some. Here is my current version
#!/bin/bash INTERNET_STATUS="UNKNOWN" TIMESTAMP=`date +%s` while [ 1 ] do # ping -c 1 -W 0.7 22.214.171.124 > /dev/null 2>&1 wget -q -O - https://staging.site.com > /dev/null 2>&1 if [ $? -eq 0 ] ; then if [ "$INTERNET_STATUS" != "UP" ]; then echo "UP `date +%Y-%m-%dT%H:%M:%S%Z` $((`date +%s`-$TIMESTAMP))"; INTERNET_STATUS="UP" fi else if [ "$INTERNET_STATUS" = "UP" ]; then echo "DOWN `date +%Y-%m-%dT%H:%M:%S%Z` $((`date +%s`-$TIMESTAMP))"; INTERNET_STATUS="DOWN" fi fi sleep 1 done;
to make it executable and then run
from the terminal to start it. You could also add a crontab, but I do not want to run it all the time or at certain times automatically. I just want to run it at will.
Wget Not Ping
As you can see I am using wget, not ping as ICMP is often blocked by ISPS. I am also using the domain of a site I work on a lot to check as TOT Thailand often has no issues displaying local websites, but sucks at dealing with sites located on the other site of the planet.
I have been running it for close to 24 hrs and here is part of the time I did not change ISP – switching to AIS 4G often due to crap TOT connection here in Thailand and an occasional router issue:
DOWN 2019-03-26T18:46:43+07 15005 UP 2019-03-26T18:46:45+07 15007 DOWN 2019-03-26T20:44:04+07 22046 UP 2019-03-26T20:44:07+07 22049 DOWN 2019-03-26T22:39:20+07 28962 UP 2019-03-26T22:39:22+07 28964 DOWN 2019-03-27T01:45:24+07 40126 UP 2019-03-27T01:45:26+07 40128 DOWN 2019-03-27T02:16:27+07 41989 UP 2019-03-27T02:16:30+07 41992 DOWN 2019-03-27T02:19:56+07 42198 UP 2019-03-27T02:20:30+07 42232 DOWN 2019-03-27T02:45:35+07 43737 UP 2019-03-27T02:45:38+07 43740 DOWN 2019-03-27T03:31:13+07 46475 UP 2019-03-27T03:31:17+07 46479
As you can see there was a lot of crap going on at night with things turning on and off from 1:45 to 3:31. Often just a few seconds. This is mainly due to TOT switching my router to a new ip in a poor way or general node or international gateway issues. Will be upgrading my local network soon so that can be excluded totally and do some more testing.
Bonus: Check Wifi Strength MacOS
To check wifi strength on OSX you can use
while x=1; do /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep CtlRSSI; sleep 0.5; done
Reading Open Gear Zendesk article you can see
- -100 dBm or less: Unacceptable signal, check antenna connection
- -99 dbm to -90 dBm: Weak signal
- -89 dbm to -70 dBm: Medium to high signal
- -69 dBm or greater: Strong signal
I just tested and got
agrCtlRSSI: -73 agrCtlRSSI: -73 agrCtlRSSI: -73 agrCtlRSSI: -73 agrCtlRSSI: -73 agrCtlRSSI: -73 agrCtlRSSI: -73 agrCtlRSSI: -73 agrCtlRSSI: -73
as my RSSI (Received Signal Strength Indicator) so Medium to High. However this is not the Signal to Noise checkup yet.
The Signal to Noise ratio check is there to really know if your wifi signal is good. A ratio based on signal and signal noise. For example I currently have an RSSSi of -74 dBm and Noise of -88 dBm the SNR will be 15 d. This is considered bad.
Here a table to help with understanding what SNR is good and bad from Wireless Nets.
> 40dB SNR = Excellent signal (5 bars); always associated; lightening fast. 25dB to 40dB SNR = Very good signal (3 - 4 bars); always associated; very fast. 15dB to 25dB SNR = Low signal (2 bars); always associated; usually fast. 10dB - 15dB SNR = Very low signal (1 bar); mostly associated; mostly slow. 5dB to 10dB SNR = No signal; not associated; no go.
NB Alt Click on Wifi Symbol in top bar will show wifi signal and noise information as well.