Created
April 4, 2012 13:39
-
-
Save telent/2301106 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat connectivity.pl | |
#!/usr/bin/perl | |
open(P,"ping dean.stargreen.com|"); | |
my $verbose=grep(@ARGV,"-v"); | |
#warn $verbose; | |
$|++; while(<P>){ | |
my($seq)=/icmp_req=(\d+)/ ; | |
print $_ if $verbose; | |
while($seq>$expected){ | |
print ((scalar gmtime)." missed $expected\n"); | |
$expected++ | |
} ; | |
$expected=$seq+1 | |
} | |
$ /usr/bin/perl ./connectivity.pl > dropped-packets.log & | |
[... some time later ...] | |
$ awk < dropped-packets.log '{print $1, $2, $3, $4, $5}' |uniq -c | awk '$1>20 {print}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment