#!/usr/bin/env perl $file=shift @ARGV; $arg=shift @ARGV; if (! defined $file) { print " usage: $0 file.rrd [c|u|z] option may be: c cut spikes down to new maximum value u set spikes to unknown z zero spikes "; exit 1; } if ( (! defined $arg) || ($arg !~ /^[cuz]$/) ) { $arg=""; } open INPUT,"rrdtool dump $file|"; if ($arg ne "") { open OUTPUT,">$file.xml"; } while () { $change=0; if (index($_,"") >= 0) { (undef,$val,undef)=split; print "Found row: $val\n"; push @NAME,$val; } if (index($_,"") >= 0) { (undef,$val,undef)=split; $val*=1; push @MAX,$val; print "Maximum : $val\n\n"; } if (index($_,"") >= 0) { (undef,$date,$time,$zone,undef,$seconds,undef,undef,@values)=split; $row=0; foreach $max (@MAX) { $value=$values[2*$row]; if ($value > $max) { $change=1; print "$date $time: $NAME[$row] $value > $max\n"; if ($arg eq "c") { $values[2*$row]=sprintf "%16e",$max; } if ($arg eq "u") { $values[2*$row]="NaN"; } if ($arg eq "z") { $values[2*$row]="0.0000000000e+00"; } } $row++; } if ($arg ne "") { if ($change>0) { ($intro)=split /\ ".join(" ",@values)."\n"; } } } if ($arg ne "") { if ($change>0) { print OUTPUT $line; } else { print OUTPUT $_; } } } close INPUT; if ($arg ne "") { close OUTPUT; print "rebuilding database...\n"; system "rrdtool restore $file.xml $file.nospike"; } WebSVN - hotsanic - Blame - Rev 5 - /branches/HotSaNIC-0.5.0-pre6/tools/rrdspikes.pl
  jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [tools/] [rrdspikes.pl] - Blame information for rev 5

 

Line No. Rev Author Line

Powered by WebSVN 2.2.1