diff options
author | Stef Walter <stef@memberwebs.com> | 2006-08-05 23:49:12 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2006-08-05 23:49:12 +0000 |
commit | 00bea63466b04190bd48bf7c984f303a92fbb8f5 (patch) | |
tree | cd8483c9a3e4441e03f64da0887483492b821006 /daemon | |
parent | 97466aa63d3bf01880cdb9b7fba3f735930ac13a (diff) |
Added support for RRD files not in the standard places. See #54
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/config.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/daemon/config.c b/daemon/config.c index 3e7c534..a47b5f2 100644 --- a/daemon/config.c +++ b/daemon/config.c @@ -58,6 +58,7 @@ typedef struct _config_ctx { const char* confname; + const char* rrdname; uint interval; uint timeout; rb_item* items; @@ -68,6 +69,8 @@ config_ctx; * STRINGS */ +#define CONFIG_GENERAL "general" +#define CONFIG_RRD "rrd" #define CONFIG_POLL "poll" #define CONFIG_INTERVAL "interval" #define CONFIG_TIMEOUT "timeout" @@ -141,8 +144,12 @@ config_done(config_ctx* ctx) ctx->timeout = g_state.timeout; /* And a nice key for lookups */ - snprintf(key, sizeof(key), "%d-%d:%s/%s.rrd", ctx->timeout, - ctx->interval, g_state.rrddir, ctx->confname); + if(ctx->rrdname) + snprintf(key, sizeof(key), "%d-%d:%s", ctx->timeout, ctx->interval, + ctx->rrdname); + else + snprintf(key, sizeof(key), "%d-%d:%s/%s.rrd", ctx->timeout, + ctx->interval, g_state.rrddir, ctx->confname); key[sizeof(key) - 1] = 0; /* See if we have one of these pollers already */ @@ -294,6 +301,15 @@ config_value(const char* header, const char* name, char* value, { char* suffix; + if(strcmp(header, CONFIG_GENERAL) == 0) + { + if(strcmp(name, CONFIG_RRD) == 0) + ctx->rrdname = value; + + /* Ignore other [general] options */ + return; + } + if(strcmp(header, CONFIG_POLL) != 0) return; |