summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5eb954c)
raw | patch | inline | side by side (parent: 5eb954c)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 12 Feb 2007 18:55:19 +0000 (19:55 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 12 Feb 2007 18:55:19 +0000 (19:55 +0100) |
src/collectd.conf.pod | patch | blob | history | |
src/rrdtool.c | patch | blob | history |
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 45acb68284cd508bab44acc0b6c66c7fa76e770c..33690ee5d1f2e6256d3eace56af072805c620ab2 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
the files. The tradeoff is that the graphs kind of "drag behind" and that more
memory is used.
+=item B<DataDir> I<Directory>
+
+Set the directory to store RRD-files under. Per default RRD-files are generated
+beneath the daemons working directory, i.E<nbsp>e. the B<BaseDir>.
+
=back
=head2 Plugin C<sensors>
diff --git a/src/rrdtool.c b/src/rrdtool.c
index 5a9fa8c6dfd042328d2fd0f082553747730da127..beb5a73e270e2a561523bfb62fb5d64d93d1f91f 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
static const char *config_keys[] =
{
"CacheTimeout",
+ "DataDir",
NULL
};
-static int config_keys_num = 1;
+static int config_keys_num = 2;
+
+static char *datadir = NULL;
static int cache_timeout = 0;
static time_t cache_flush;
int offset = 0;
int status;
+ if (datadir != NULL)
+ {
+ status = snprintf (buffer + offset, buffer_len - offset,
+ "%s/", datadir);
+ if ((status < 1) || (status >= buffer_len - offset))
+ return (-1);
+ offset += status;
+ }
+
status = snprintf (buffer + offset, buffer_len - offset,
"%s/", vl->host);
if ((status < 1) || (status >= buffer_len - offset))
}
cache_timeout = tmp;
}
+ else if (strcasecmp ("DataDir", key) == 0)
+ {
+ if (datadir != NULL)
+ free (datadir);
+ datadir = strdup (val);
+ if (datadir != NULL)
+ {
+ int len = strlen (datadir);
+ while ((len > 0) && (datadir[len - 1] == '/'))
+ {
+ len--;
+ datadir[len] = '\0';
+ }
+ if (len <= 0)
+ {
+ free (datadir);
+ datadir = NULL;
+ }
+ }
+ }
else
{
return (-1);