version 1.1, 2006/05/08 20:52:53 |
version 1.3, 2006/11/07 19:55:30 |
|
|
#!/usr/bin/perl -T |
#!/usr/bin/perl -T |
# $RedRiver$ |
# $RedRiver: average_rrd,v 1.2 2006/05/08 22:22:19 andrew Exp $ |
use strict; |
use strict; |
use warnings; |
use warnings; |
|
|
|
|
|
|
use constant VERBOSE => 0; |
use constant VERBOSE => 0; |
|
|
my $file = shift || '/var/www/wstationinfo/rrlhcwap3056/rrlhcwap3056-id_6-RSSI.rrd'; |
my $file = shift || 'test.rrd'; |
|
|
|
die "File '$file' does not exist!" unless -e $file; |
|
|
my %TIMES = ( |
my %TIMES = ( |
FIVE_MINUTES => 5 * 60, |
FIVE_MINUTES => 5 * 60, |
ONE_HOUR => 1 * 60 * 60, |
ONE_HOUR => 1 * 60 * 60, |
|
|
next unless defined $line->[$i]; |
next unless defined $line->[$i]; |
foreach my $key (keys %TIMES) { |
foreach my $key (keys %TIMES) { |
if ($end - $TIMES{$key} < $start) { |
if ($end - $TIMES{$key} < $start) { |
|
foreach ('max', 'min') { |
|
$totals{ $names->[$i] }{$key}{$_} = $line->[$i] |
|
unless defined $totals{ $names->[$i] }{$key}{$_}; |
|
} |
|
no warnings q/uninitialized/; |
$totals{ $names->[$i] }{$key}{'count'}++; |
$totals{ $names->[$i] }{$key}{'count'}++; |
$totals{ $names->[$i] }{$key}{'total'} += $line->[$i]; |
$totals{ $names->[$i] }{$key}{'total'} += $line->[$i]; |
|
$totals{ $names->[$i] }{$key}{'max'} = $line->[$i] |
|
if $totals{ $names->[$i] }{$key}{'max'} < $line->[$i]; |
|
$totals{ $names->[$i] }{$key}{'min'} = $line->[$i] |
|
if $totals{ $names->[$i] }{$key}{'min'} > $line->[$i]; |
} |
} |
} |
} |
} |
} |