Skip to content

Instantly share code, notes, and snippets.

@telent
Created April 4, 2012 13:39
Show Gist options
  • Save telent/2301106 to your computer and use it in GitHub Desktop.
Save telent/2301106 to your computer and use it in GitHub Desktop.
$ 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