our $outpfx= './';
our $sep= '_';
our $debug= 0;
+our $interval= 30;
open DEBUG, ">/dev/null" or die $!;
if (s/^-h//) { $dohosts{$_}=1; last; }
elsif (s/^-O//) { $outpfx=$_; last; }
elsif (s/^-s//) { $sep=$_; last; }
+ elsif (s/^-i([1-9]\d{0,5})$//) { $interval= $1; }
elsif (s/^-D/-/) { $debug++; }
else { die "bad option $_"; }
}
my @args= ($rrd->{Path}, '--template',$rrd->{Template},
join(':',$rrd_blockedupdate_time,@$vals));
- print DEBUG "update @args\n";
+ print DEBUG "update @args\n" if $debug>=2;
RRDs::update(@args);
my $err= RRDs::error;
die "$err [@args]" if defined $err;
our %in_conns;
sub inbound_connected () {
- print DEBUG "inbound connected $host $peer $conn\n";
+ print DEBUG "inbound connected $host $peer $conn\n" if $debug>=2;
$in_conns{$host,$peer,$conn} = [ (0) x @fields_in ];
}
sub inbound_closed () {
- print DEBUG "inbound closed $host $peer $conn\n";
+ print DEBUG "inbound closed $host $peer $conn\n" if $debug>=2;
delete $in_conns{$host,$peer,$conn};
}
sub inbound_stats () {
print DEBUG "inbound UNKNOWN $host $peer $conn $stats\n";
$in_conns{$host,$peer,$conn}= $hpc= [ (undef) x @fields_in ];
} else {
- print DEBUG "inbound stats $host $peer $conn $stats\n";
+ print DEBUG "inbound stats $host $peer $conn $stats\n" if $debug>=2;
}
while (s/^([a-z_]+) (\d+)\s//) { $s{$1}= $2; }
my @v;
exit 0 if $totail eq '';
my $tailer= new File::Tail name=>$totail,
- interval=>60, adjustafter=>2, ignore_nonexistant=>1, tail=>-1
+ interval=>$interval, adjustafter=>2, ignore_nonexistant=>1, tail=>-1
or die "$totail $!";
run($tailer);