summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 97a0180)
raw | patch | inline | side by side (parent: 97a0180)
author | Florian Forster <ff@octo.it> | |
Tue, 7 Sep 2010 14:44:26 +0000 (16:44 +0200) | ||
committer | Florian Forster <ff@octo.it> | |
Tue, 7 Sep 2010 14:44:26 +0000 (16:44 +0200) |
share/collection.conf | patch | blob | history | |
src/Makefile.am | patch | blob | history | |
src/data_provider.c | [new file with mode: 0644] | patch | blob |
src/data_provider.h | patch | blob | history | |
src/dp_rrdtool.c | patch | blob | history | |
src/dp_rrdtool.h | [new file with mode: 0644] | patch | blob |
src/graph_config.c | patch | blob | history |
diff --git a/share/collection.conf b/share/collection.conf
index c2d501e34cb73aab344ff162d242506303bb7534..3634446ae29cbee1a6b40863d6a643ce4bdb9e9d 100644 (file)
--- a/share/collection.conf
+++ b/share/collection.conf
+<DataProvider "rrdtool">
+ DataDir "/var/lib/collectd/rrd"
+</DataProvider>
+
<Graph>
Host "/any/"
Plugin "cpu"
diff --git a/src/Makefile.am b/src/Makefile.am
index d5c74e13103f5cea96c9571e9f0a3ac5bd465e62..741f7e5ce2dc4736b2cb66a7bcaf0f390f153ac3 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
action_show_graph_json.c action_show_graph_json.h \
action_show_instance.c action_show_instance.h \
common.c common.h \
- dp_rrdtool.c \
+ data_provider.c data_provider.h \
+ dp_rrdtool.c dp_rrdtool.h \
filesystem.c filesystem.h \
graph_types.h \
graph.c graph.h \
diff --git a/src/data_provider.c b/src/data_provider.c
--- /dev/null
+++ b/src/data_provider.c
@@ -0,0 +1,33 @@
+/**
+ * collection4 - data_provider.c
+ * Copyright (C) 2010 Florian octo Forster
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ *
+ * Authors:
+ * Florian octo Forster <ff at octo.it>
+ **/
+
+#include "data_provider.h"
+#include "dp_rrdtool.h"
+
+int data_provider_config (const oconfig_item_t *ci) /* {{{ */
+{
+ /* FIXME: Actually determine which data provider to call. */
+ return (dp_rrdtool_config (ci));
+} /* }}} int data_provider_config */
+
+/* vim: set sw=2 sts=2 et fdm=marker : */
diff --git a/src/data_provider.h b/src/data_provider.h
index a5e9c76dca25796bf742233d4de3a4c2347d6bdd..6dbcd1e8702cdfd79a67eb820910bdab4f7df502 100644 (file)
--- a/src/data_provider.h
+++ b/src/data_provider.h
#define DATA_PROVIDER_H 1
#include "graph_types.h"
+#include "oconfig.h"
#include <time.h>
};
typedef struct data_provider_s data_provider_t;
+int data_provider_config (const oconfig_item_t *ci);
+
#endif /* DATA_PROVIDER_H */
/* vim: set sw=2 sts=2 et fdm=marker : */
diff --git a/src/dp_rrdtool.c b/src/dp_rrdtool.c
index 214603d637ac00a6d69b5b9342ecc0b296713f24..b72e512c9fe9a2a570050889470d35cfb045cf15 100644 (file)
--- a/src/dp_rrdtool.c
+++ b/src/dp_rrdtool.c
return (-1);
} /* }}} int print_graph */
-int dp_rrdtool_config (oconfig_item_t *ci)
+int dp_rrdtool_config (const oconfig_item_t *ci)
{ /* {{{ */
dp_rrdtool_t *conf;
diff --git a/src/dp_rrdtool.h b/src/dp_rrdtool.h
--- /dev/null
+++ b/src/dp_rrdtool.h
@@ -0,0 +1,32 @@
+/**
+ * collection4 - dp_rrdtool.h
+ * Copyright (C) 2010 Florian octo Forster
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ *
+ * Authors:
+ * Florian octo Forster <ff at octo.it>
+ **/
+
+#ifndef DP_RRDTOOL_H
+#define DP_RRDTOOL_H 1
+
+#include "oconfig.h"
+
+int dp_rrdtool_config (const oconfig_item_t *ci);
+
+#endif /* DP_RRDTOOL_H */
+/* vim: set sw=2 sts=2 et fdm=marker : */
diff --git a/src/graph_config.c b/src/graph_config.c
index 4f58df0667d0322051cb2067e616038388599b76..6d2402b5c926047d15cd5d398864cde2dba5104e 100644 (file)
--- a/src/graph_config.c
+++ b/src/graph_config.c
#include "graph_list.h"
#include "oconfig.h"
#include "common.h"
+#include "data_provider.h"
#ifndef CONFIGFILE
# define CONFIGFILE "/etc/collection.conf"
child = ci->children + i;
if (strcasecmp ("Graph", child->key) == 0)
graph_config_add (child);
+ else if (strcasecmp ("DataProvider", child->key) == 0)
+ data_provider_config (child);
else
{
DEBUG ("Unknown config option: %s", child->key);