summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2006-08-05 23:49:12 +0000
committerStef Walter <stef@memberwebs.com>2006-08-05 23:49:12 +0000
commit00bea63466b04190bd48bf7c984f303a92fbb8f5 (patch)
treecd8483c9a3e4441e03f64da0887483492b821006 /tools
parent97466aa63d3bf01880cdb9b7fba3f735930ac13a (diff)
Added support for RRD files not in the standard places. See #54
Diffstat (limited to 'tools')
-rw-r--r--tools/rrdbot-create.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/tools/rrdbot-create.c b/tools/rrdbot-create.c
index c75b95f..f3699a1 100644
--- a/tools/rrdbot-create.c
+++ b/tools/rrdbot-create.c
@@ -55,6 +55,7 @@
#define DEFAULT_WORK "/var/db/rrdbot"
#define CONFIG_CREATE "create"
+#define CONFIG_GENERAL "general"
#define CONFIG_POLL "poll"
#define CONFIG_INTERVAL "interval"
#define CONFIG_ARCHIVE "archive"
@@ -62,6 +63,7 @@
#define CONFIG_MIN "min"
#define CONFIG_MAX "max"
#define CONFIG_CF "cf"
+#define CONFIG_RRD "rrd"
#define VAL_UNKNOWN "U"
#define VAL_ABSOLUTE "ABSOLUTE"
@@ -125,6 +127,7 @@ typedef struct _create_ctx
{
const char* workdir;
const char* confname;
+ const char* rrdname;
uint interval;
const char *cf;
int create;
@@ -439,8 +442,13 @@ check_create_file(create_ctx* ctx)
if(!ctx->create)
return;
- snprintf(rrd, sizeof(rrd), "%s/%s.rrd", ctx->workdir, ctx->confname);
- rrd[sizeof(rrd) - 1] = 0;
+ if(ctx->rrdname)
+ strlcpy(rrd, ctx->rrdname, sizeof(rrd));
+ else
+ {
+ snprintf(rrd, sizeof(rrd), "%s/%s.rrd", ctx->workdir, ctx->confname);
+ rrd[sizeof(rrd) - 1] = 0;
+ }
/* Make sure it exists */
if(access(rrd, F_OK) == 0)
@@ -603,6 +611,16 @@ cfg_value(const char* filename, const char* header, const char* name,
return 0;
}
+ if(strcmp(header, CONFIG_GENERAL) == 0)
+ {
+ /* rrd option */
+ if(strcmp(name, CONFIG_RRD) == 0)
+ ctx->rrdname = value;
+
+ /* Ignore other options */
+ return 0;
+ }
+
/* The rest is in the [create] section */
if(strcmp(header, CONFIG_CREATE) != 0)
return 0;