From: John-John Tedro Date: Mon, 2 Sep 2013 21:30:51 +0000 (+0000) Subject: PUTNOTIF: Add the ability to populate meta options X-Git-Tag: collectd-5.5.0~257^2~1 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=d30d3dfa061850cdc8daf9a8b52c8d838d4b4f35;p=collectd.git PUTNOTIF: Add the ability to populate meta options --- diff --git a/src/utils_cmd_putnotif.c b/src/utils_cmd_putnotif.c index 5a9faff2..af9cf0e8 100644 --- a/src/utils_cmd_putnotif.c +++ b/src/utils_cmd_putnotif.c @@ -68,6 +68,18 @@ static int set_option (notification_t *n, const char *option, const char *value) DEBUG ("utils_cmd_putnotif: set_option (option = %s, value = %s);", option, value); + /* Add a meta option in the form: : */ + if (option[0] != '\0' && option[1] == ':') { + /* Refuse empty key */ + if (option[2] == '\0') + return (1); + + if (option[0] == 's') + return plugin_notification_meta_add_string (n, option + 2, value); + else + return (1); + } + if (strcasecmp ("severity", option) == 0) return (set_option_severity (n, value)); else if (strcasecmp ("time", option) == 0) diff --git a/src/utils_parse_option.c b/src/utils_parse_option.c index 820f14f5..8086d63f 100644 --- a/src/utils_parse_option.c +++ b/src/utils_parse_option.c @@ -127,7 +127,7 @@ int parse_option (char **ret_buffer, char **ret_key, char **ret_value) /* Look for the equal sign */ buffer = key; - while (isalnum ((int) *buffer) || *buffer == '_') + while (isalnum ((int) *buffer) || *buffer == '_' || *buffer == ':') buffer++; if ((*buffer != '=') || (buffer == key)) return (1);