On Fri, Sep 21, 2001 at 03:02:35PM +0200, Patrick Rother wrote: > When a new rrd files is created all values are undef and new values get > added. > I would like to dump all data to xml, replace all values within a given > time range that are undef with zero, and reimport the data. > > This looks quite easy to do in perl, but it's still some work to implement, > so before reinventing the wheel I would like to ask if someone has done this > before who could share the code. $ cat thewheel.pl #!/usr/bin/perl -w use strict; if (not defined $ARGV[0] or not $ARGV[0]) { print STDERR "Usage: $0 rrdfile\n\n"; exit; } my ($file) = @ARGV; die "rrdfile does not exists.\n" unless (-e $file); my $tmp = "zeroize.tmp.$$"; open (OUT, ">$tmp") or die; open (IN, "rrdtool dump $file |") or die; my $z = 0; while () { if ($z) { if (m#^(\s* )NaN( )NaN( \n)#) { $_ = $1.'0'.$2.'0'.$3; } else { $z = 0; } } elsif (/^\s*$/) { $z = 1; } print OUT $_; } close OUT; close IN; print `rrdtool restore $tmp $file -r 2>&1`; unlink $tmp; $ -- Binary/unsupported file stripped by Listar -- -- Err : No filename to use for decode, file stripped. -- Type: application/pgp-signature -- Unsubscribe mailto:rrd-users-request@list.ee.ethz.ch?subject=unsubscribe Help mailto:rrd-users-request@list.ee.ethz.ch?subject=help Archive http://www.ee.ethz.ch/~slist/rrd-users WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi