[rrd-users] Re: merge round robin databases

George Dau gedau at isa.mim.com.au
Fri Sep 8 02:44:36 MEST 2000


I dump the rrd with `rrdtool dump`, then parse through it and add in the new
data producing a new xml file, then `rrdttool restore` to create the new
.rrd file.
It isn't meant to be pretty, flexible, portable or anything else, but I
needed to merge two rrds in a hurry. It is also 327 lines long, so I decided
not to mail it to the list. It is too specific to the job I had to do
anyway. Heres the first few lines of what I resorted to - you'll get the
idea. E-mail me if you want the entire thing.

#include <stdio.h>

int count,i,j,k,l;
char a[1024];
char b[1024];
char c[1024];
FILE *fa;
FILE *fb;
FILE *fc;

int main() {
  fa=fopen("a.xml","r");
  fb=fopen("b.xml","r");
  fc=fopen("c.xml","w");

/* Copy the 5 lines of header up to first <ds> tag from a to c. */
  for(l=0;l<5;l++) {
    fgets(a,1024,fa);
    fgets(b,1024,fb);
    fputs(a,fc);
  }

/* Copy the first 2 ds's from b to c. */
  for(l=0;l<26;l++) {
    fgets(b,1024,fb);
    fputs(b,fc);
  }

/* Copy 19 ds's from a to c. */
  for(l=0;l<247;l++) {
    fgets(a,1024,fa);
    fputs(a,fc);
  }

/* Copy remaining 4 ds's from b to c. */
/* and change the ds numbers on the way past. */
  for(l=0;l<52;l++) {
    fgets(b,1024,fb);
    if (b[3]==110) {
      switch (b[11]) {

and so on for 327 lines of code....



**********************************************************************
The information contained in this e-mail is confidential and is
intended only for the use of the addressee(s).
If you receive this e-mail in error, any use, distribution or 
copying of this e-mail is not permitted. You are requested to
forward unwanted e-mail and address any problems to the 
MIM Holdings Limited Support Centre.

e-mail: supportcentre at mim.com.au
phone: Australia 1800500646
**********************************************************************

--
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