-   Linux - Newbie (
-   -   monitor internet connectivity (

sumeet inani 05-14-2012 01:56 AM

monitor internet connectivity
Hi ,
I want to measure the time for which my internet connection works during whole day . Is there a software that logs the time for which internet was not accessible .
I can write a script & put it in cron to check every minute . But , for that what will be parameter to check net access .

I tried to ping but did not got any reply . Though surfing was fine .

PING ( 56(84) bytes of data.
--- ping statistics ---
192 packets transmitted, 0 received, 100% packet loss, time 190999ms

Also my interface is

$ /sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 70:71:BC:CB:DE:47 
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::7271:bcff:fecb:de47/64 Scope:Link
          RX packets:821 errors:0 dropped:0 overruns:0 frame:0
          TX packets:742 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:120822 (117.9 KiB)  TX bytes:59717 (58.3 KiB)

lo        Link encap:Local Loopback 
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4115 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4115 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:8029660 (7.6 MiB)  TX bytes:8029660 (7.6 MiB)

zXi 05-14-2012 02:40 AM

Cacti and squid might be useful in this case. In Cacti, you must be able to interpret the graph of usage. To do so, start downloading any torrent which might take a whole day and start cacti to monitor the usage, wherever you see a drop or red spikes, internet is down.

Do make sure that your firewall is allowed for ICMP [ping ] packets to go through. When you are able to ping google,
using ping will also work, provided you write a small script leading to:

ping -c 2
if [$? != 0] then
echo `date +%F%T` >> /tmp/loggingfile
echo \e "\nnet is down\n------\n" >> /tmp/loggingfile
elsif sleep 30
Reiterate the script for every 30 secs. I forgot shell scripting long back. But I hope you get the idea.

All times are GMT -5. The time now is 03:01 PM.