projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bb54fd1
)
rename command to query
author
Pierre-Yves Ritschard
<pyr@spootnik.org>
Thu, 20 Nov 2014 12:13:18 +0000
(13:13 +0100)
committer
Pierre-Yves Ritschard
<pyr@spootnik.org>
Thu, 20 Nov 2014 12:13:18 +0000
(13:13 +0100)
src/redis.c
patch
|
blob
|
history
diff --git
a/src/redis.c
b/src/redis.c
index
02f3edd
..
ea997ac
100644
(file)
--- a/
src/redis.c
+++ b/
src/redis.c
@@
-40,7
+40,7
@@
#define MAX_REDIS_NODE_NAME 64
#define MAX_REDIS_PASSWD_LENGTH 512
#define MAX_REDIS_VAL_SIZE 256
#define MAX_REDIS_NODE_NAME 64
#define MAX_REDIS_PASSWD_LENGTH 512
#define MAX_REDIS_VAL_SIZE 256
-#define MAX_REDIS_
COMMAND
2048
+#define MAX_REDIS_
QUERY
2048
/* Redis plugin configuration example:
*
/* Redis plugin configuration example:
*
@@
-54,14
+54,14
@@
* </Plugin>
*/
* </Plugin>
*/
-struct redis_
command
_s;
-typedef struct redis_
command_s redis_command
_t;
-struct redis_
command
_s
+struct redis_
query
_s;
+typedef struct redis_
query_s redis_query
_t;
+struct redis_
query
_s
{
{
- char
command[MAX_REDIS_COMMAND
];
+ char
query[MAX_REDIS_QUERY
];
char type[DATA_MAX_NAME_LEN];
char instance[DATA_MAX_NAME_LEN];
char type[DATA_MAX_NAME_LEN];
char instance[DATA_MAX_NAME_LEN];
- redis_
command
_t *next;
+ redis_
query
_t *next;
};
struct redis_node_s;
};
struct redis_node_s;
@@
-73,7
+73,7
@@
struct redis_node_s
char passwd[MAX_REDIS_PASSWD_LENGTH];
int port;
struct timeval timeout;
char passwd[MAX_REDIS_PASSWD_LENGTH];
int port;
struct timeval timeout;
- redis_
command_t *command
s;
+ redis_
query_t *querie
s;
redis_node_t *next;
};
redis_node_t *next;
};
@@
-122,15
+122,15
@@
static int redis_node_add (const redis_node_t *rn) /* {{{ */
return (0);
} /* }}} */
return (0);
} /* }}} */
-static redis_
command_t *redis_config_command
(oconfig_item_t *ci) /* {{{ */
+static redis_
query_t *redis_config_query
(oconfig_item_t *ci) /* {{{ */
{
{
- redis_
command
_t *rc;
+ redis_
query
_t *rc;
int status;
int i;
rc = calloc(1, sizeof(*rc));
if (rc == NULL) {
int status;
int i;
rc = calloc(1, sizeof(*rc));
if (rc == NULL) {
- ERROR("redis plugin: calloca failed adding redis_
command
.");
+ ERROR("redis plugin: calloca failed adding redis_
query
.");
return NULL;
}
status = cf_util_get_string_buffer(ci, rc->type, sizeof(rc->type));
return NULL;
}
status = cf_util_get_string_buffer(ci, rc->type, sizeof(rc->type));
@@
-141,15
+141,15
@@
static redis_command_t *redis_config_command (oconfig_item_t *ci) /* {{{ */
oconfig_item_t *option = ci->children + i;
if (strcasecmp("Exec", option->key) == 0) {
oconfig_item_t *option = ci->children + i;
if (strcasecmp("Exec", option->key) == 0) {
- status = cf_util_get_string_buffer(option, rc->
command, sizeof(rc->command
));
+ status = cf_util_get_string_buffer(option, rc->
query, sizeof(rc->query
));
} else if (strcasecmp("Instance", option->key) == 0) {
status = cf_util_get_string_buffer(option, rc->instance, sizeof(rc->instance));
}
if (status != 0)
goto err;
}
} else if (strcasecmp("Instance", option->key) == 0) {
status = cf_util_get_string_buffer(option, rc->instance, sizeof(rc->instance));
}
if (status != 0)
goto err;
}
- if (strlen(rc->
command
) == 0) {
- WARNING("redis plugin: invalid
command
definition for: %s", rc->type);
+ if (strlen(rc->
query
) == 0) {
+ WARNING("redis plugin: invalid
query
definition for: %s", rc->type);
goto err;
}
return rc;
goto err;
}
return rc;
@@
-161,7
+161,7
@@
static redis_command_t *redis_config_command (oconfig_item_t *ci) /* {{{ */
static int redis_config_node (oconfig_item_t *ci) /* {{{ */
{
redis_node_t rn;
static int redis_config_node (oconfig_item_t *ci) /* {{{ */
{
redis_node_t rn;
- redis_
command
_t *rc;
+ redis_
query
_t *rc;
int i;
int status;
int timeout;
int i;
int status;
int timeout;
@@
-170,7
+170,7
@@
static int redis_config_node (oconfig_item_t *ci) /* {{{ */
sstrncpy (rn.host, REDIS_DEF_HOST, sizeof (rn.host));
rn.port = REDIS_DEF_PORT;
rn.timeout.tv_usec = REDIS_DEF_TIMEOUT;
sstrncpy (rn.host, REDIS_DEF_HOST, sizeof (rn.host));
rn.port = REDIS_DEF_PORT;
rn.timeout.tv_usec = REDIS_DEF_TIMEOUT;
- rn.
command
s = NULL;
+ rn.
querie
s = NULL;
status = cf_util_get_string_buffer (ci, rn.name, sizeof (rn.name));
if (status != 0)
status = cf_util_get_string_buffer (ci, rn.name, sizeof (rn.name));
if (status != 0)
@@
-191,14
+191,14
@@
static int redis_config_node (oconfig_item_t *ci) /* {{{ */
status = 0;
}
}
status = 0;
}
}
- else if (strcasecmp ("
Command
", option->key) == 0)
+ else if (strcasecmp ("
Query
", option->key) == 0)
{
{
- rc = redis_config_
command
(option);
+ rc = redis_config_
query
(option);
if (rc == NULL) {
status =1;
} else {
if (rc == NULL) {
status =1;
} else {
- rc->next = rn.
command
s;
- rn.
command
s = rc;
+ rc->next = rn.
querie
s;
+ rn.
querie
s = rc;
}
}
else if (strcasecmp ("Timeout", option->key) == 0)
}
}
else if (strcasecmp ("Timeout", option->key) == 0)
@@
-315,7
+315,7
@@
int redis_handle_info (char *node, char const *info_line, char const *type, char
} /* }}} int redis_handle_info */
} /* }}} int redis_handle_info */
-int redis_handle_
command (redisContext *rh, redis_node_t *rn, redis_command
_t *rc) /* {{{ */
+int redis_handle_
query (redisContext *rh, redis_node_t *rn, redis_query
_t *rc) /* {{{ */
{
redisReply *rr;
const data_set_t *ds;
{
redisReply *rr;
const data_set_t *ds;
@@
-332,8
+332,8
@@
int redis_handle_command (redisContext *rh, redis_node_t *rn, redis_command_t *r
return (-1);
}
return (-1);
}
- if ((rr = redisCommand(rh, rc->
command
)) == NULL) {
- WARNING("redis plugin: unable to carry out
command `%s'.", rc->command
);
+ if ((rr = redisCommand(rh, rc->
query
)) == NULL) {
+ WARNING("redis plugin: unable to carry out
query `%s'.", rc->query
);
return (-1);
}
return (-1);
}
@@
-375,7
+375,7
@@
int redis_handle_command (redisContext *rh, redis_node_t *rn, redis_command_t *r
static int redis_read (void) /* {{{ */
{
redis_node_t *rn;
static int redis_read (void) /* {{{ */
{
redis_node_t *rn;
- redis_
command
_t *rc;
+ redis_
query
_t *rc;
for (rn = nodes_head; rn != NULL; rn = rn->next)
{
for (rn = nodes_head; rn != NULL; rn = rn->next)
{
@@
-430,8
+430,8
@@
static int redis_read (void) /* {{{ */
freeReplyObject (rr);
freeReplyObject (rr);
- for (rc = rn->
command
s; rc != NULL; rc = rc->next)
- redis_handle_
command
(rh, rn, rc);
+ for (rc = rn->
querie
s; rc != NULL; rc = rc->next)
+ redis_handle_
query
(rh, rn, rc);
redisFree (rh);
}
redisFree (rh);
}