X-Git-Url: http://git.rot13.org/?p=influxdb-pipes;a=blobdiff_plain;f=ifstat.pl;fp=ifstat.pl;h=832f24a01a7b6d00483a62e635dba51905711eae;hp=a43b626cc267917383a68c40011a2b177995eabf;hb=e666fa3b7bf5f321c639e48d5c10588f0054b58c;hpb=ac5e07b7f49645d60a5e53cc7bbeb19cd0e39f1e diff --git a/ifstat.pl b/ifstat.pl index a43b626..832f24a 100755 --- a/ifstat.pl +++ b/ifstat.pl @@ -46,6 +46,8 @@ my $lines; my $host_tags = $host; $host_tags =~ s/\./,domain=/; +my $last_hour = $hour; + while(<$ifstat>) { chomp; #warn "# [$_]\n"; @@ -61,6 +63,12 @@ while(<$ifstat>) { @direction = map { s/\W+/_/g; s/^K//; $_ } @v; } elsif ( $v[0] =~ m/^(\d\d):(\d\d):(\d\d)/ ) { next unless $first_skipped++; + + if ( $last_hour != $hour ) { + ($sec,$min,$hour,$dd,$mm,$yyyy) = localtime(time); $mm++; + $last_hour = $hour; + } + $hour = $1; $min = $2; $sec = $3; update_time; reopen_curl;