Last active
August 29, 2015 13:58
-
-
Save ilyaevseev/10000993 to your computer and use it in GitHub Desktop.
Find connectivity failures in collectd reports.
This file contains 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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
my $MIN_DELTA = 120; | |
my $nan; | |
my $last_good; | |
while(<>) { | |
chomp; | |
next unless /^(\d+),(.+)$/; | |
if ($2 eq 'nan') { | |
$nan = 1; | |
} else { | |
printf "%5s seconds: %s - %s\n", | |
$last_good ? $1 - $last_good : '?', | |
$last_good ? "".localtime($last_good) : '?', | |
"".localtime($1) | |
if $nan and $last_good and $1 - $last_good > $MIN_DELTA; | |
$nan = 0; | |
$last_good = $1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment