Hi! I have written a C program which use RRD C API functions rrd_create(), rrd_update() and rrd_dump() to create, update and show the contents of the RRD database. I want to fill the RRD database with the integers returned by C rand( ) function i.e. the random value generated by the rand( ) function is stored against each timestamp.
Below is my code snippet: char *updateparams[] = { "rrdupdate", "Flow1bytes.rrd", "???:Bytecounter[i]", NULL }; for (i=0; i < 50; i++) { flow1.bytes= rand(); Bytecounter[i]=flow1.bytes; rrd_update(3,updateparams); } Please guide me how can I access the timestamp variable and write it in the update parameter at the place marked by ???. The code for creating the Flow1bytes.rrd database is this: char *createparams[] = { "rrdcreate", "Flow1bytes.rrd", "--step=1", "DS:Bytecounter:COUNTER:1000:0:800", "RRA:AVERAGE:0.5:1:50", NULL }; rrd_create(5, createparams); Thank you. On Thu, Nov 28, 2013 at 11:01 AM, Fizza Hussain <12mseefhuss...@seecs.edu.pk > wrote: > Thank you so much Petteri for your help.. > > I am definitely going to try this out.. > > > On Thu, Nov 28, 2013 at 12:43 AM, Petteri Matilainen <pma...@gmail.com>wrote: > >> On 27.11.2013 13:12, Fizza Hussain wrote: >> > Hi, >> > >> > I want to create and update the RRD database from a C code. For that >> > purpose, I have included rrd.h file in my source code and have linked >> > the C code against librrd library. These two steps are done perfectly. >> > However, I am facing some difficulties in figuring out what arguments >> > should I provide to the functions provided by C API? For example, >> > rrd_create( ) function takes an int and a char string as its arguments. >> > i.e. {int rrd_create(int , char **)}. >> > >> > >> > I have previously used rrdtool via CLI and am comfortable with its CLI >> > commands rrdtool create test.rrd --start 90234 (and so on). Please guide >> > me what should be the arguments to the rrd_create( ) function provided >> > by C API. >> > >> > >> > >> > Thanks, >> > >> > Fizza Hussain >> > >> > >> > _______________________________________________ >> > rrd-users mailing list >> > rrd-users@lists.oetiker.ch >> > https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users >> > >> >> Hi Fizza, >> >> The create function takes only 2 arguments: the count and the array of >> pointers to the arguments. Among the first links in google I found this >> example: http://permalink.gmane.org/gmane.comp.db.rrdtool.devel/894 >> There's an example on how to use the create function and many others. >> Note that the examples are for an older version of rrdtool so you may >> have to modify the code. >> >> regards, >> >> Pete >> >> >> _______________________________________________ >> rrd-users mailing list >> rrd-users@lists.oetiker.ch >> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users >> > >
_______________________________________________ rrd-users mailing list rrd-users@lists.oetiker.ch https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users