[rrd-users] Re: rrd-users - Using librrd in C programs

Pitisi dpitisi at lfdj.com
Mon Nov 10 09:17:50 MET 2003


Hi Andreas,
Thank you for your help. the optind = 0 instruction resolved my problem. It
seems to work without adding a NULL pointer as the last
parameter, but I keep it since it doesn't cost a lot!

I found out another strange thing:
before a call to rrd_update I print my command line:
for ( i = 0; i < 5; i++)
    printf("%s ",cmd_update[i]);

and I have on the screen:
update fic.rrd --template DSName 1067264490:5.500000
and that's correct

Then I call:
rrd_update(5,cmd_update);

And, just after, print my command line one  more time with the same
instructions, and I have:
update --template DSName fic.rrd 1067264490:5.500000

Parameter 2 (fic.rrd) is now in 4th position ! ! ! ! !
Do you have an explanation for that??

Thank you for your help

Didier

Andreas Maus a écrit :

> On Fri, Nov 07, 2003 at 04:30:42PM +0100, Pitisi wrote:
> Hi.
> > I write a C program and try to use RRD commands in it, but I can't find
> > any documentation about librrd API.
> Unfortunately there is no documentation of the API around. :-(
>
> > Can somebody tell me where I can find such a documentation, or describe
> > the syntax of the update command. I tried the following:
> > int ret;
> > char *cmd_update[5];
> >
> > cmd_update[0] = "update";
> > cmd_update[1] = "fic.rrd";
> > cmd_update[2] = "--template";
> > cmd_update[3] = "DSName";
> > cmd_update[4] = "1067264490:1280";
> Is cmd_update[5] === NULL ?
> If I recall correctly the rrd_* functions parse the input with getopt and
> if you give options on the command line the argv array is
> NULL terminated at argv[argc].
>
> Another pitfall is caused by the fact that getopt uses the optind
> variable and this variable is global !
>
> So you have to reset optind before each call to rrd_*()
> It's a simple optind=0 but its annoying...
>
> Hope this helps...Andreas.
>
> P.S.: Hmmm... Maybe I will write a small documentation of the rrdtool-API.
>
> --
> Dipl.-Ing. Andreas Maus             science+computing ag
> System Administration               Hagellocher Weg 71-75
> mail: a.maus at science-computing.de   72070 Tuebingen, Germany
> tel.: +49 7071 9457 456             www.science-computing.de
>
> -- Binary/unsupported file stripped by Ecartis --
> -- Err : No filename to use for decode, file stripped.
> -- Type: application/pgp-signature
>
> --
> 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


-- Attached file removed by Ecartis and put at URL below --
-- Type: text/plain
-- Size: 1k (1255 bytes)
-- URL : http://www.ee.ethz.ch/~slist/p/04-Disclaimer.txt


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