[mrtg] Re: changing historical data in an RRD

Steve Shipway s.shipway at auckland.ac.nz
Wed Jul 21 22:57:44 MEST 2004

>However, once I do that, my historical data will still be inaccurate. 
>I'm looking for a solution to modifying the RRD so that I can 
>swap the 2 
>values for historical data.  If I weren't using RRD this would be a 
>snap; simply cut and past the columns of data to their 
>appropriate spots.
>Also, I know I can do an RRDTool export and get the data in an XML 
>format, but manipulating that data is my weak point. So I'm 
>looking for help on hacking the data in the RRD.
Try this.

First, dump the data to XML
rrdtool dump filename.rrd > filename.xml
Then convert it using script below
swap.pl < filename.xml > filename2.xml
Then reload
rrdtool restore filename2.xml filename.rrd

This will work as long as they have the same ranges and so on.


while(<>) {
	if( /^(.*)<v>(.*)</v><v>(.*)</v>(.*)$/ ) {
		print "$1<v>$3</v><v>$2</v>$4\n";
	} else {print "$_\n";}

I admit this is straight from my brain and untested, but it should work, I
think.  Obviously, back up your data first!


Steve Shipway: ITSS, University of Auckland
Email: s.shipway at auckland.ac.nz  Web: http://www.steveshipway.org/  
** We can only discover new oceans when we have the **
** courage to lose sight of the shore.              **

-- Attached file removed by Ecartis and put at URL below --
-- Type: text/x-vcard
-- Size: 155 bytes
-- URL : http://www.ee.ethz.ch/~slist/p/39-Steve%20Shipway.vcf

Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

More information about the mrtg mailing list