From: Andres J. Diaz Date: Mon, 9 Aug 2010 08:45:06 +0000 (+0200) Subject: Fix a number of minor bugs. X-Git-Tag: collectd-5.0.0-beta0~50^2~7 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=d6ef3dad2f3dc9d7c35a9bbb563e52c3f0c1ec7c;p=collectd.git Fix a number of minor bugs. - The Port configuration option is a string, not a number. Fix documentation. - Fix a bad status assignement in port parser. - Remove default node. Now node is mandatory to prevent duplicates in tree. - Update configuration example too. --- diff --git a/src/collectd.conf.in b/src/collectd.conf.in index 8389e830..c96edad2 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -743,8 +743,7 @@ # # # Host "redis.example.com" -# Port 6379 -# Database 0 +# Port "6379" # Timeout 2000 # # diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 6aba1958..4541870b 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -3756,14 +3756,12 @@ Defaults to B. The C plugin connect to a list of redis servers and gather information about the server state. The C plugin support multiserver configuration, each server configuration block is called node and identify -one redis instance (host and port). If no B block found, then any -configuration option is assigned to a virtual node called C. Here -are a configuration example code: +one redis instance (host and port). Here is a configuration example code: Host "localhost" - Port 6379 + Port "6379" Timeout 2000 diff --git a/src/redis.c b/src/redis.c index ec69631d..0ccc8ba8 100644 --- a/src/redis.c +++ b/src/redis.c @@ -83,7 +83,7 @@ static int redis_config_node (redis_node_t *rn, oconfig_item_t *ci) /* {{{ */ if (strcasecmp ("Host", option->key) == 0) status = cf_util_get_string_buffer (option, rn->host, sizeof (rn->host)); else if (strcasecmp ("Port", option->key) == 0) - status = rn->port = cf_util_get_port_number (option); + rn->port = cf_util_get_port_number (option); else if (strcasecmp ("Timeout", option->key) == 0) status = cf_util_get_int (option, &rn->timeout); else @@ -182,12 +182,6 @@ static int redis_config (oconfig_item_t *ci) /* {{{ */ if ( (status = redis_config_node (&rn, option)) == 0 ) status = redis_node_add (&rn); } - else if (strcasecmp ("Host", option->key) == 0) - status = cf_util_get_string_buffer (option, rn.host, sizeof (rn.host)); - else if (strcasecmp ("Port", option->key) == 0) - status = rn.port = cf_util_get_port_number (option); - else if (strcasecmp ("Timeout", option->key) == 0) - status = cf_util_get_int (option, &rn.timeout); else { WARNING ("redis plugin: Option `%s' not allowed in redis" @@ -200,10 +194,6 @@ static int redis_config (oconfig_item_t *ci) /* {{{ */ break; } - if ( status == 0 && *rn.name != '\0') { - status = redis_node_add (&rn); - } - return (status); } /* }}} */ @@ -276,7 +266,7 @@ static int redis_read (void) /* {{{ */ while (c_avl_iterator_next (iter, (void *) &key, (void *) &rn) == 0) { - DEBUG ("redis plugin: querying info from node `%s'.", rn->name); + DEBUG ("redis plugin: querying info from node `%s' (%s:%d).", rn->name, rn->host, rn->port); if ( (rh = credis_connect (rn->host, rn->port, rn->timeout)) == NULL ) {