summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7535ee8)
raw | patch | inline | side by side (parent: 7535ee8)
author | Sebastian Harl <sh@tokkee.org> | |
Wed, 8 Jun 2016 22:36:18 +0000 (00:36 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 25 Sep 2016 10:42:45 +0000 (12:42 +0200) |
diff --git a/src/daemon/common.c b/src/daemon/common.c
index 654a5a0968a741d9c1b0a7997dc888ed262b0515..e05da5ceab15bff5c867321013aa2c08cbdd1ac3 100644 (file)
--- a/src/daemon/common.c
+++ b/src/daemon/common.c
int parse_identifier (char *str, char **ret_host,
char **ret_plugin, char **ret_plugin_instance,
- char **ret_type, char **ret_type_instance)
+ char **ret_type, char **ret_type_instance,
+ char *default_host)
{
char *hostname = NULL;
char *plugin = NULL;
type = strchr (plugin, '/');
if (type == NULL)
- return (-1);
- *type = '\0'; type++;
+ {
+ if (default_host == NULL)
+ return (-1);
+ /* else: no host specified; use default */
+ type = plugin;
+ plugin = hostname;
+ hostname = default_host;
+ }
+ else
+ {
+ *type = '\0';
+ type++;
+ }
plugin_instance = strchr (plugin, '-');
if (plugin_instance != NULL)
status = parse_identifier (str_copy, &host,
&plugin, &plugin_instance,
- &type, &type_instance);
+ &type, &type_instance,
+ /* default_host = */ NULL);
if (status != 0)
return (status);
diff --git a/src/daemon/common.h b/src/daemon/common.h
index 6d01ca4bdeef5e3b1a74bea55c1686bcddb9a5cb..67ca1c14cc6e8d9fcdbe4f70de47911d33d69f2d 100644 (file)
--- a/src/daemon/common.h
+++ b/src/daemon/common.h
int parse_identifier (char *str, char **ret_host,
char **ret_plugin, char **ret_plugin_instance,
- char **ret_type, char **ret_type_instance);
+ char **ret_type, char **ret_type_instance,
+ char *default_host);
int parse_identifier_vl (const char *str, value_list_t *vl);
int parse_value (const char *value, value_t *ret_value, int ds_type);
int parse_values (char *buffer, value_list_t *vl, const data_set_t *ds);
diff --git a/src/utils_cmd_flush.c b/src/utils_cmd_flush.c
index cfd6a48182677932d099abb669974df64dc0fba8..7e26be7b54774c9dfc1bfad36e14a7e447d89f6d 100644 (file)
--- a/src/utils_cmd_flush.c
+++ b/src/utils_cmd_flush.c
ret_flush->identifiers_num++;
if (parse_identifier (opt_value,
&id->host, &id->plugin, &id->plugin_instance,
- &id->type, &id->type_instance) != 0)
+ &id->type, &id->type_instance,
+ NULL) != 0)
{
cmd_error (CMD_PARSE_ERROR, err,
"Invalid identifier `%s'.", opt_value);
index b2a0a23bfd892e7b77b6e24c4c1ad3934d69a6bc..e6086f27193226c631f9bb7e4a8358c0dde545e2 100644 (file)
status = parse_identifier (identifier_copy, &host,
&plugin, &plugin_instance,
- &type, &type_instance);
+ &type, &type_instance,
+ /* default_host = */ NULL);
if (status != 0)
{
DEBUG ("handle_getthreshold: Cannot parse identifier `%s'.", identifier);
diff --git a/src/utils_cmd_getval.c b/src/utils_cmd_getval.c
index 76af189477c9205f5e2a125e228789c95b78b7e4..3a8a2be8ada2ebdce5ff3f835b853b539fdf2ba0 100644 (file)
--- a/src/utils_cmd_getval.c
+++ b/src/utils_cmd_getval.c
status = parse_identifier (argv[0], &ret_getval->identifier.host,
&ret_getval->identifier.plugin, &ret_getval->identifier.plugin_instance,
- &ret_getval->identifier.type, &ret_getval->identifier.type_instance);
+ &ret_getval->identifier.type, &ret_getval->identifier.type_instance,
+ NULL);
if (status != 0)
{
DEBUG ("cmd_parse_getval: Cannot parse identifier `%s'.", identifier_copy);
diff --git a/src/utils_cmd_putval.c b/src/utils_cmd_putval.c
index af6b484d29f126f0a6badbe3adbf7c2a1d701697..0a0af8aede8b42ff663f9298b5a98d455cdf3f1f 100644 (file)
--- a/src/utils_cmd_putval.c
+++ b/src/utils_cmd_putval.c
status = parse_identifier (identifier, &hostname,
&plugin, &plugin_instance,
- &type, &type_instance);
+ &type, &type_instance,
+ NULL);
if (status != 0)
{
DEBUG ("cmd_handle_putval: Cannot parse identifier `%s'.",