[rrd-users] Q about copying an existing rrd database and zeroing out the data

Bill Benedetto bbenedetto at goodyear.com
Wed Feb 16 19:59:46 MET 2005

Good day.

I'm writing a script to allow a user to "create" a new rrd
database by copying an existing rrd database.  The first part of
the script does all the non-rrdtool setup that I require and the
last part of the script is the creation of the rrd database.

Since this new rrd database is just a "copy" of an already
existing database (all the same parameters and settings - just
different data), I found that I could just copy the old one to
the new name.  That works well enough but all of the data from
the old rrd database is in the new database (obviously!) and I
don't want it to be.

I had hoped that there would be some rrdtool command that I could
run to clean out all of the data.  But I haven't found one.

So I wrote a Perl script to do an "rrdtool dump" and edit the XML
to change the data to "NaN" and then do an "rrdtool restore" on
that edited XML.  And that works well enough but it is kind of
slow.  Hence my wish for an rrdtool command to clean out all of
the data but leave the rest of the database settings alone.

Of course, some issues are no doubt coming to your mind:

 o I don't know how/when the rrd database was created.  Hence my
   wish to just copy an existing rrd database.  I can't just
   create the new one as I don't know the parameter settings in
   the old one.

 o I'm not opposed to doing this all in a script (IE, not doing
   the copy).  I tried doing an RRDs::fetch from the old database
   but I couldn't figure out how to use the hash from that as
   input for RRDs::create for the new database.

Any suggestions?


- Bill
Bill Benedetto     <bbenedetto at goodyear.com>    The Goodyear Tire & Rubber Co.
I don't speak for Goodyear and they don't speak for me.  We're both happy.

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