[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [hobbit] hobbitd_larrd is crashing



rrdtool performs as expected:

-bash-2.05b$ /usr/local/rrdtool-1.2.10/bin/rrdtool create /foo.rrd
DS:sec:GAUGE:600:0:U RRA:AVERAGE:0.5:1:576
ERROR: creating '/foo.rrd': Permission denied

Thanks,
Larry Barber


On 6/9/06, Henrik Stoerner <henrik (at) hswn.dk> wrote:

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


To unsubscribe from the hobbit list, send an e-mail to hobbit-unsubscribe (at) hswn.dk