[rrd-users] reversing values in rrd file

Shipley, Rob rshipley at state.mt.us
Wed Apr 10 20:57:07 MEST 2002


I am wanting to reverse the DS values from a dumped file.( rrdtool dump
sample.rrd >sample.xml)  I am attempting to do it in perl but it's not
working. Does any one have a script they use - or any idea how to do this.
I'm thinking it is an issue with substituting floating literals. 
Thanks
p.s. Here is the script I am attempting to use
-------cut ----------
#target is the output xml file that will have the values reversed
#getvalues is the existing xml file
$target = $ARGV[1];
$getvalues = $ARGV[0];
open (MAIN, ">$target")|| die "open the target file.\n";
open (VALUES, $getvalues)|| die "open the values file.\n";
#Loop through the xml file from the main rrd file you want values imported
into
while (<VALUES>)
{
$valuein = $_;
if ($valuein =~
m/^\t\t\t<!--\s.*\s.*\s\w*\s\w*\s\w*\s-->\s<row><v>\s(.*)\s<\/v><v>\s(.*)\s<
\/v><\/row>$/)
{
($mds0,$mds1)=($1,$2);
$valuein =~ s/$mds0/value1/;
$valuein =~ s/$mds1/value2/;
$valuein =~ s/value1/$mds1/;
$valuein =~ s/value2/$mds0/;
#When I print, the values are stored in $mds0 & $mds1 but don't substitute
or change unless they are NaN.
#print "values:$mds0,$mds1 -> $valuein\n";
}
print MAIN $valuein;
}
close(VALUES);
close(MAIN);
---------end-----------

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list