Swapping the two variables in an RRD is very easy, and doesn't involve creating a new RRD. The two data sources are named "ds0" and "ds1" inside the RRD, and all we have to do is swap the names, not the values.
Try this: rrdtool tune file.rrd -r ds0:tmp rrdtool tune file.rrd -r ds1:ds0 rrdtool tune file.rrd -r tmp:ds1 Replace "file.rrd" with the name of your RRD database. This sequence renames the "ds0" data source to "tmp", then renames "ds1" to "ds0", and finally, renames "tmp" to "ds1". Your data will now be swapped. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Arnold Nipper Sent: Wednesday, July 21, 2004 4:57 PM To: Eric Brander Cc: [EMAIL PROTECTED] Subject: [mrtg] Re: changing historical data in an RRD On 21.07.2004 21:22 Eric Brander wrote: > 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. > doing an export an swapping the two positions is really easy. You even don't have to know what XML is. Simply keep all the lines you don't know what they mean and swap position in the "data" lines. A data line looks like: <!-- 2004-07-21 02:00:00 CEST / 1090368000 --> <row><v> 3.0291166667e+02 </v><v> 1.3062150000e+03 </v></row> if you would like to do it with an awk-script this should do it for a rrd with in/out: # begin script # # look for data rows, $9 and $11 are the data values. Just swap, the go to next line. /<!--.*row/ { s=$9; $9=$11; $11=s; print; next; } # If not a data line, just print { print } # # end script Arnold -- Unsubscribe mailto:[EMAIL PROTECTED] 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 -- Unsubscribe mailto:[EMAIL PROTECTED] 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
