Code

Don't require a named backend
authorScott Sanders <scott@jssjr.com>
Sun, 2 Oct 2011 20:28:32 +0000 (16:28 -0400)
committerScott Sanders <scott@jssjr.com>
Sun, 2 Oct 2011 20:28:32 +0000 (16:28 -0400)
Naming a backend adds no value to the configuration and only serves to
complicate things. Multiple unamed carbon backends are still allowed.
Documentation updated to reflect the change.

src/write_graphite.c

index 64c7b434320274a2cfc1ec2905587b8e7ecdb5cd..e8bdc65ca0b01febe40326172dfda7254074185c 100644 (file)
@@ -24,7 +24,7 @@
  /* write_graphite plugin configuation example
   *
   * <Plugin write_graphite>
-  *   <Carbon "local-agent">
+  *   <Carbon>
   *     Host "localhost"
   *     Port 2003
   *     Prefix "collectd"
@@ -66,8 +66,6 @@
  */
 struct wg_callback
 {
-    char    *name;
-
     int      sock_fd;
     struct hostent *server;
 
@@ -210,7 +208,6 @@ static void wg_callback_free (void *data)
     wg_flush_nolock (/* timeout = */ 0, cb);
 
     close(cb->sock_fd);
-    sfree(cb->name);
     sfree(cb->host);
     sfree(cb->prefix);
 
@@ -631,17 +628,12 @@ static int wg_config_carbon (oconfig_item_t *ci)
     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->name, ci);
-    if (cb->name == NULL)
-        return (-1);
-
     for (i = 0; i < ci->children_num; i++)
     {
         oconfig_item_t *child = ci->children + i;