[hobbit] hobbitd_larrd is crashing

Henrik Stoerner henrik at hswn.dk
Sat Jun 10 00:16:40 CEST 2006


On Fri, Jun 09, 2006 at 05:01:55PM -0500, Larry Barber wrote:
> No joy, it is still crashing, stack trace:

Does rrdtool work for you? Try running
   rrdtool create /foo.rrd DS:sec:GAUGE:600:0:U RRA:AVERAGE:0.5:1:576
Assuming you're not root, this should print out the message
   ERROR: creating '/foo.rrd': Permission denied

> I was looking at your patch, and it doesn't look to me like that new lines
> are doing the same thing as the old:
> 
> -	strcat(filedir, "/"); strcat(filedir, fn);
> +	snprintf(filedir, sizeof(filedir)-1, "%s/%s/%s", rrddir, hostname, fn);
> +	filedir[sizeof(filedir)-1] = '\0';
> 	creparams[1] = filedir;	/* Icky */
> 
> It looks like the original line creates something like "filedir/fn"
> while the new lines create something like "filedir/hostname/fn". Is
> this right?

It is. In the old version, "filedir" contained the rrd top-level
directory + the hostname, e.g. "/hobbit/rrd/myhost", and then it
added an extra "/" and the rrd filename.

The new version just uses snprintf() to output the top-level
directory + the hostname-directory + the rrd filename in one go.

	sprintf(filedir, "%s/%s", rrddir, hostname);
	if (stat(filedir, &st) == -1) {
		...
	}
	snprintf(filedir, sizeof(filedir)-1, "%s/%s/%s", rrddir, hostname, fn);
	filedir[sizeof(filedir)-1] = '\0';


Regards,
Henrik




More information about the Xymon mailing list