There isn't really easy way to handle this in every case. That will return error if DNS server is not responding, even if OpenDNS or your own provider's DNS server works fine. You can write short workaround with host, for example host. If your provider has cached your DNS record, but the DNS server is down, others can't access your site even though monitoring says everything is fine. Yet again, there are shortcomings in this approach. Checking the return code is straightforward way to do implement this: wget -spider -quiet Įcho "Website failed!" | mail -s "Website down" You'll get some false positives when your computer is down, or when your DNS server is not working. Second, using wget -spider for your own script is a good idea. (Disclaimer: I am not affiliated with Pingdom in any way). To pick one, Pingdom includes free account for monitoring one target. What do you think?įirst, multiple good online monitoring services are available. Also (I was trying to avoid any I/O) I can write to a log file by which I can check the count of downtime checks and then skip further checks till the site is down or cause longer checks (10mins instead of every min). Right? Also how can I randomize pinging to a different site everytime, like facebook, google, yahoo etc. Its a bit heavy (as I am not using ping) but should not give any false positives. This way I need to check for internet connectivity only where there is an issue with my blog response code. # Check if we have internet connectivity by some other siteįLAG=1 # This means we do have internet connectivity and the blog is actually downĭISPLAY=:0 notify-send -t 2000 -i /home/ashfame/Dropbox/Ubuntu/icons/network-idle.png "Downtime Alert!" " is down." # A good point is to check if the internet is working or not # Traverse the string considering it as an array of words # Sending the output of the wget in a variable and not what wget fetches Here is my script to keep checking downtime for my blog: #!/bin/bash So, checking for DNS and LAN connectivity is a bit overkill for me as I don't have that much specific need to figure out what problem it is. Now I want to make sure that it displays me notification when I do have internet connectivity. So I keep on getting notifications as the script couldn't find 200 in the wget response. LAN was connected fine but just I couldn't access any site. Now yesterday, there was some problem with my Internet. If its not 200, it notifies me (I believe this will be better than just pinging it, as the site may under be heavy load and may be timing out or respond very late). I have setup cron to check it every minute.įor this, I am checking the HTTP response code of wget -spider to my blog. My intention at the moment is to check if my blog is down. But I think there must be easy way without the need of checking a site that never crash )Įdit: Seems like there can be a lot of factors which can be individually examined, good thing. One idea I seem is to wget -spider and check the HTTP response code to interpret if the Internet connection is working fine. (Friday and Saturday nights are not a good choice.Is there an easy way to check Internet connectivity from console? I am trying to play around in a shell script. If you really want to find out what your best possible Bandwidth Speed Test result is, try loading this page at 1:00am on a weeknight, when almost everyone is asleep when Internet use is at it’s lowest. you’ll typically notice faster internet connectivity. When fewer people are online, such as after 11 p.m. Internet traffic during peak hours tend to lead to slower internet connections. Just as you have to wait in a your car for a traffic light, data sent to your computer has to wait while other data passes through routers, switches, and hubs (The Internet equivalent of an intersection). Similar to highways you get traffic delays. The Internet is like a major highway system, the Internet Information Highway has many roadways and interchanges, each having their own capacity and speed limit. Why do I get different speed results each time I run The Bandwidth Speed Test? PEAK Internet is a part of the global network.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |