- 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. Signed-off-by: Andres J. Diaz <[email protected]> --- src/collectd.conf.in | 3 +-- src/collectd.conf.pod | 6 ++---- src/redis.c | 14 ++------------ 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/collectd.conf.in b/src/collectd.conf.in index 8389e83..c96edad 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -743,8 +743,7 @@ #<Plugin redis> # <Node example> # Host "redis.example.com" -# Port 6379 -# Database 0 +# Port "6379" # Timeout 2000 # </Node> #</Plugin> diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 6aba195..4541870 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -3756,14 +3756,12 @@ Defaults to B<false>. The C<redis> plugin connect to a list of redis servers and gather information about the server state. The C<redis> plugin support multiserver configuration, each server configuration block is called node and identify -one redis instance (host and port). If no B<Node> block found, then any -configuration option is assigned to a virtual node called C<default>. Here -are a configuration example code: +one redis instance (host and port). Here is a configuration example code: <Plugin redis> <Node example> Host "localhost" - Port 6379 + Port "6379" Timeout 2000 </Node> </Plugin> diff --git a/src/redis.c b/src/redis.c index ec69631..0ccc8ba 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 ) { -- 1.6.4.4 _______________________________________________ collectd mailing list [email protected] http://mailman.verplant.org/listinfo/collectd
