[rrd-users] Re: Adding DS's - without import/export?

Alex van den Bogaerdt alex at slot.hollandcasino.nl
Sun Mar 4 17:29:43 MET 2001

Jason Fesler wrote:

> I'm stumbling my way into actually adding a "addds" command into rrdtool.
> It is really fun walking into someone else's code and trying to peice
> things together (grin).  I may need to poke you if I get stumped (I got
> sidetracked today).  I *hope* to have something that looks like it works
> for me, in which case I'd love for you to code review it and possibly put
> it into rrdtool.  I'm picking apart parts of rrd_dump.c and rrd_restore.c
> to try and figure out what I need to do.
> As I understand, rrd_restore actually builds from XML, a complete rrd
> "image" in memory.  My current goal is to read an existing rrd file, add
> in the extra ds entry, fill in the appropriate fields, and actually
> populate the data, then use rrd_write from rrd_restore.c to write a new
> file to disk.

I think you should probably do this differently.  Basically the RRD
file format is a number of RRAs, each RRA being built from a number
of rows, each row being built from a number of CDPs.  What you need
to do is:

   read the original header
   change number of DSes
   write it to another file
   for each RRA {
      for each row {
         for each original ds {
            read value from original file
            write value into new file
         write new ds value(s) into new file
   rename file over original file

Let the OS handle efficiency, it should read and write blocks anyway.
I think this approach is more easy and thus less prone to errors.

> wish me luck..

Good luck!

 / alex at slot.hollandcasino.nl                  alex at ergens.op.het.net \
| work                                                         private |
| My employer is capable of speaking therefore I speak only for myself |
| Technical questions sent directly to me will be nuked. Use the list. | 
| http://faq.mrtg.org/                                                 |
| http://rrdtool.eu.org  --> tutorial                                  |

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