[BACK]Return to average_rrd CVS log [TXT][DIR] Up to [local] / nagios / check_rrd / bin

Diff for /nagios/check_rrd/bin/average_rrd between version 1.1 and 1.3

version 1.1, 2006/05/08 20:52:53 version 1.3, 2006/11/07 19:55:30
Line 1 
Line 1 
 #!/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;
   
Line 8 
Line 8 
   
 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,
Line 56 
Line 58 
                 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];
                         }                          }
                 }                  }
         }          }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>