[rrd-developers] rrd_create() funny problem

Ambles Kock ambles at inktomi.com
Thu Oct 25 16:58:02 MEST 2001


Hi folks,

I have been struggling with rrd.h and rrdlib.a for awhile. I hope some of you can shed some lights....

I am using a C program to create a bunch of ???.rrd file. I copied the CountArgs() and CreateArgs() function from rrd_tool.c to my program so I can create a array of string from something like 

"create blah1.rrd -b N -s 300 DS:ds:GAUGE:6000:0:100 RRA:AVERAGE:0.5:1:288"

This string is used as the 2nd argument for CreateArgs(). I used a loop to create blah1.rrd blah2.rrd ... blahx.rrd with the same parameters. However, as I execute my program. Something funny happen.....the program successfully generated the blah1.rrd, but it didn't generate another other blah?.rrd. Instant it also generated a second file named "300". I think create_rrd() picked up the "300" from the -s flag. BTW, rrd_create did not complain about bad arguments.

The following is my code segment......

  sprintf(createStr, "%s ./%s.rrd %s %s %s", string1, ds->filename, string2, block, string3);
  printf("%s\n", createStr);
  
  int argc = 0;
  char **myargv = NULL;
  if ((argc = CountArgs(createStr)) == 0) {
    perror("Insufficient arguments\n");
    exit(-1);
  }
  if ((myargv = (char **) malloc ((argc+1) * sizeof(char *))) == NULL) {
    perror("malloc failed\n");
    exit (-1);
  }
  argc = CreateArgs("blah", createStr, argc, myargv);
  if (argc <=0) {
    printf ("Honston, we have a problem.\n");
    exit;
  }

-awk

-awk

Ambles Kock                        I N K T O M I              Tel: 650-653-5636
Software Engineer          Essential to the Internet      Fax:650-653-1848

--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-developers
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-developers mailing list