Skip to content

Instantly share code, notes, and snippets.

@ilyaevseev
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyaevseev/10000993 to your computer and use it in GitHub Desktop.
Save ilyaevseev/10000993 to your computer and use it in GitHub Desktop.
Find connectivity failures in collectd reports.
#!/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