summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 92af8f3)
raw | patch | inline | side by side (parent: 92af8f3)
author | Scott Sanders <scott@jssjr.com> | |
Mon, 8 Aug 2011 14:55:23 +0000 (10:55 -0400) | ||
committer | Scott Sanders <scott@jssjr.com> | |
Mon, 8 Aug 2011 14:55:23 +0000 (10:55 -0400) |
write_graphite.c | patch | blob | history |
diff --git a/write_graphite.c b/write_graphite.c
index b58dbfb06701953e9342a8edc7a85042cee5c44c..420b78558ea1f1f45f377f876638a6b91a7eb4e9 100644 (file)
--- a/write_graphite.c
+++ b/write_graphite.c
* based on the excellent write_http plugin
**/
+ /* write_graphite plugin configuation example
+ *
+ * <Plugin write_graphite>
+ * <Carbon "local-agent">
+ * Host "localhost"
+ * Port 2003
+ * Prefix "collectd"
+ * </Carbon>
+ * </Plugin>
+ */
+
#include "collectd.h"
#include "common.h"
#include "plugin.h"
*/
struct wg_callback
{
+ char *name;
+
int sock_fd;
struct hostent *server;
memset (cb, 0, sizeof (*cb));
cb->sock_fd = -1;
cb->host = NULL;
+ cb->name = NULL;
cb->port = 2003;
cb->prefix = NULL;
cb->server = NULL;
pthread_mutex_init (&cb->send_lock, /* attr = */ NULL);
- config_set_string (&cb->host, ci);
- if (cb->host == NULL)
+ config_set_string (&cb->name, ci);
+ if (cb->name == NULL)
return (-1);
for (i = 0; i < ci->children_num; i++)
{
oconfig_item_t *child = ci->children + i;
- if (strcasecmp ("Port", child->key) == 0)
+ if (strcasecmp ("Host", child->key) == 0)
+ config_set_string (&cb->host, child);
+ else if (strcasecmp ("Port", child->key) == 0)
config_set_number (&cb->port, child);
else if (strcasecmp ("Prefix", child->key) == 0)
config_set_string (&cb->prefix, child);