|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Segmentation Fault - Basic Test of RRDTool 1.2.19Yes, I am a beginner on this - trying to work out how to use it. I can create an RRD file, can update values to it and then fetch those values. But when I come to do a graph I get a segmentation fault.
//Create graph sprintf(argstr, "temperature.rrd --start %ld --step 60 DS:temp:GAUGE:120:-273:5000 RRA:AVERAGE:0.5:1:1200 RRA:MIN:0.5:60:400 RRA:MAX:0.5:60:400 RRA:AVERAGE:0.5:60:400", start_time); // evey min for 20 hours : every 10 minutes for 400 hours (max, min, ave) ret = wrap_rrd_create( argstr); //Add in many values using this sprintf(str, "temperature.rrd %ld:%f", (long)next_time, value); ret = wrap_rrd_update( str); //When I do a fetch I can see that the values have loaded correctly, so now using the same start and end time I want to produce a temp.png file //Create Graph - but this returns a segmentation fault (core dumped) sprintf(argstr, "temp.png --start %lu --end %lu DEF:mytemp=temperature.rrd:temp:AVERAGE", (long)start_time, (long)end_time); ret = wrap_rrd_graph( argstr); //And now I get a segmentation fault. What am I doing wrong please? TIA Mark |
|
|
Re: Segmentation Fault - Basic Test of RRDTool 1.2.19On 4/16/07, Mark Easton <mark.easton@...> wrote:
> > //Create Graph - but this returns a segmentation fault (core dumped) > sprintf(argstr, "temp.png --start %lu --end %lu > DEF:mytemp=temperature.rrd:temp:AVERAGE", (long)start_time, (long)end_time); > > ret = wrap_rrd_graph( argstr); rrd_wrapper from the contrib section of the rrdtool website is dated 17-Dec-2001. It has not been kept up and isn't compatible with rrdtool 1.2.x. Actually, I'm not sure how you got it to compile; I receive the following error: $ gcc -o test -lrrd main.c rrdwrap.c rrdwrap.c: In function 'wrap_rrd_graph': rrdwrap.c:165: error: too few arguments to function 'rrd_graph' I would guess you have an old version of rrd.h and rrd_tool.h, but somehow linking to the 1.2.x version of the library (librrd.so). I've attached a patch against rrdwrap.c that at least makes it compile (and fixes a memory leak). As you can see, rrd_wrapper is out-of-date and unmaintained. I urge you to consider using the librrd API directly. Look at main() in src/rrd_tool.c you'll see how the command-line rrdtool does this. -Sam [rrdwrap.patch] --- rrdwrap.c.orig 2007-04-16 19:35:26.000000000 -0400 +++ rrdwrap.c 2007-04-16 19:39:39.000000000 -0400 @@ -156,15 +156,24 @@ i, argc, xsize, // must be passed to the rrd_graph function but does not need to be initialised ysize; // must be passed to the rrd_graph function but does not need to be initialised + double + ymin, // must be passed to the rrd_graph function but does not need to be initialised + ymax; // must be passed to the rrd_graph function but does not need to be initialised if((argv = string_to_argv(argstr, &argc)) != NULL) { optind=0; /* reset gnu getopt */ opterr=0; /* no error messages */ - i = rrd_graph(argc, argv, prdata, &xsize, &ysize); + i = rrd_graph(argc, argv, prdata, &xsize, &ysize, NULL, &ymin, &ymax); // free up the memory + if (prdata) { + for(i=0;prdata[i];i++) { + free(prdata[i]); + } + free(prdata); + } Free_argv(argv); return i; _______________________________________________ rrd-users mailing list rrd-users@... https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users |
|
|
Re: Segmentation Fault - Basic Test of RRDTool 1.2.19>rrd_wrapper from the contrib section of the rrdtool website is dated
>17-Dec-2001. It has not been kept up and isn't compatible with >rrdtool 1.2.x. Actually, I'm not sure how you got it to compile; Yes I know, I wrote my own rrd_wrap which works against rrd_tool.c. When I run "rrdtool graph" command line I also dont get a graph. It just retunds to std out "0x0". |
|
|
Re: Segmentation Fault - Basic Test of RRDTool 1.2.19On 4/16/07, Mark Easton <mark.easton@...> wrote:
> > >rrd_wrapper from the contrib section of the rrdtool website is dated > >17-Dec-2001. It has not been kept up and isn't compatible with > >rrdtool 1.2.x. Actually, I'm not sure how you got it to compile; > > Yes I know, I wrote my own rrd_wrap which works against rrd_tool.c. Well, then please post the source code if you'd like help with that seg fault. > When I run "rrdtool graph" command line I also dont get a graph. It just > retunds to std out "0x0". The command line you put together doesn't have any output lines (LINE{1,2,3}, AREA, STACK, GPRINT). Check out the tutorial on the website for some example rrdtool graph commands that work. -Sam _______________________________________________ rrd-users mailing list rrd-users@... https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users |
| Free embeddable forum powered by Nabble | Forum Help |