summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 36f6513)
raw | patch | inline | side by side (parent: 36f6513)
author | Florian Forster <octo@noris.net> | |
Wed, 22 Sep 2010 13:56:26 +0000 (15:56 +0200) | ||
committer | Florian Forster <octo@noris.net> | |
Wed, 22 Sep 2010 14:00:36 +0000 (16:00 +0200) |
share/collection.conf | patch | blob | history | |
src/graph_config.c | patch | blob | history | |
src/graph_config.h | patch | blob | history |
diff --git a/share/collection.conf b/share/collection.conf
index 06387d37ac8c67a1b10a8d5caed4ab1588b2393d..855d15fba18af58eb1e1f15f54355f2773a76bbd 100644 (file)
--- a/share/collection.conf
+++ b/share/collection.conf
+CacheFile "/tmp/collection4.json"
+
<DataProvider "rrdtool">
DataDir "/var/lib/collectd/rrd"
</DataProvider>
diff --git a/src/graph_config.c b/src/graph_config.c
index 6d2402b5c926047d15cd5d398864cde2dba5104e..5d275f0d6b4c4f5a1d8eee79796581078f038471 100644 (file)
--- a/src/graph_config.c
+++ b/src/graph_config.c
# define CONFIGFILE "/etc/collection.conf"
#endif
-time_t last_read_mtime = 0;
+#ifndef CACHEFILE
+# define CACHEFILE "/tmp/collection4.json"
+#endif
+
+static time_t last_read_mtime = 0;
+
+static char *cache_file = NULL;
static int dispatch_config (const oconfig_item_t *ci) /* {{{ */
{
graph_config_add (child);
else if (strcasecmp ("DataProvider", child->key) == 0)
data_provider_config (child);
+ else if (strcasecmp ("CacheFile", child->key) == 0)
+ graph_config_get_string (child, &cache_file);
else
{
DEBUG ("Unknown config option: %s", child->key);
return (0);
} /* }}} int graph_config_get_bool */
+const char *graph_config_get_cache_file (void) /* {{{ */
+{
+ if (cache_file == NULL)
+ return (CACHEFILE);
+ return (cache_file);
+} /* }}} char graph_config_get_cache_file */
+
/* vim: set sw=2 sts=2 et fdm=marker : */
diff --git a/src/graph_config.h b/src/graph_config.h
index 5ccfadfd735877f4a65c309034f57891651a12f1..877bebc0b1cc151bef8c6db70e324d50221535d3 100644 (file)
--- a/src/graph_config.h
+++ b/src/graph_config.h
int graph_config_get_string (const oconfig_item_t *ci, char **ret_str);
int graph_config_get_bool (const oconfig_item_t *ci, _Bool *ret_bool);
+const char *graph_config_get_cache_file (void);
+
/* vim: set sw=2 sts=2 et fdm=marker : */
#endif /* GRAPH_CONFIG_H */