#!/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 /\; $line="$intro ".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 6 - /branches/HotSaNIC-0.5.0-pre6/tools/rrdspikes.pl Català-Valencià - CatalanČesky - CeskyDansk - DanskDutch - DutchEnglish - EnglishFinnish - FinnishFrançais - FrancaisDeutsch - Germanעברית - HebrewMagyar - HungarianBahasa Indonesia - IndonesianItaliano - Italian日本語 - Japanese한국어 - KoreanNorsk - NorwegianPolski - PolishPortuguês - PortuguesePortuguês - Brazilian PortugueseРусский - Russian中文 - Simplified ChineseSlovenčina - SlovakSlovenčina - SlovenianEspañol - SpanishSvenska - Swedish中文 - Traditional ChineseTürkçe - TurkishOëzbekcha - Uzbek hotsanic Subversion Repositories: banderdyncentos.prosek.czfcrusaderczf4bfuczf4bfu.prosek.czfczfcentosczfgmapdiscoverfedora.prosek.czffreenet-routerftthgetonlinecloudshotsanicinternet.prosek.czfismapstatsmeteolingernetmapqossedlosedlo.prosek.czfswitchesvbtobbvlubntweathermapweatherstatswebsvnwifidashboardwifimonwww.prosek.czfxenstats [/] [branches/] [HotSaNIC-0.5.0-pre6/] [tools/] [rrdspikes.pl] - Blame information for rev 6 Line No. Rev Author Line Powered by WebSVN 2.2.1