diff --git a/src/libs/zbxconf/cfg.c b/src/libs/zbxconf/cfg.c index 29b661deda9..456c0587abf 100644 --- a/src/libs/zbxconf/cfg.c +++ b/src/libs/zbxconf/cfg.c @@ -426,9 +426,9 @@ static int __parse_cfg_file(const char *cfg_file, struct cfg_line *cfg, int leve FILE *file; int i, lineno, param_valid; - char line[MAX_STRING_LEN + 3], *parameter, *value; + char line[MAX_STRING_LEN + 3], *parameter, *value, *cfg_options_read; zbx_uint64_t var; - size_t len; + size_t len, cfg_size = 0; #ifdef _WINDOWS wchar_t *wcfg_file; #endif @@ -438,6 +438,11 @@ static int __parse_cfg_file(const char *cfg_file, struct cfg_line *cfg, int leve return FAIL; } + for (i = 0; NULL != cfg[i].parameter; i++) + cfg_size++; + + cfg_options_read = calloc(cfg_size, sizeof(*cfg_options_read)); + if (NULL != cfg_file) { #ifdef _WINDOWS @@ -497,6 +502,18 @@ static int __parse_cfg_file(const char *cfg_file, struct cfg_line *cfg, int leve if (0 != strcmp(cfg[i].parameter, parameter)) continue; + if (TYPE_MULTISTRING != cfg[i].type && TYPE_CUSTOM != cfg[i].type) + { + if (0 != cfg_options_read[i]) + { + zabbix_log(LOG_LEVEL_WARNING, "parameter %s is listed more than once at" + " line %d, previous values will be ignored", + parameter, lineno); + } + + cfg_options_read[i] = 1; + } + param_valid = 1; zabbix_log(LOG_LEVEL_DEBUG, "accepted configuration parameter: '%s' = '%s'", @@ -582,6 +599,8 @@ static int __parse_cfg_file(const char *cfg_file, struct cfg_line *cfg, int leve } } + zbx_free(cfg_options_read); + return SUCCEED; cannot_open: if (ZBX_CFG_FILE_REQUIRED != optional) @@ -612,6 +631,8 @@ unknown_parameter: missing_mandatory: zbx_error("missing mandatory parameter \"%s\" in config file \"%s\"", cfg[i].parameter, cfg_file); error: + zbx_free(cfg_options_read); + if (0 == noexit) exit(EXIT_FAILURE); diff --git a/src/libs/zbxpreproc/pp_error.c b/src/libs/zbxpreproc/pp_error.c index ec432528ff7..23e9102ec25 100644 --- a/src/libs/zbxpreproc/pp_error.c +++ b/src/libs/zbxpreproc/pp_error.c @@ -50,6 +50,7 @@ ZBX_PTR_VECTOR_IMPL(pp_result_ptr, zbx_pp_result_t *) ******************************************************************************/ void pp_result_set(zbx_pp_result_t *result, const zbx_variant_t *value, int action, zbx_variant_t *value_raw) { + zabbix_log(LOG_LEVEL_CRIT, "DIMBUG In %s(): value:%s raw:%s", __func__, value->data.str, value_raw->data.str); zbx_variant_copy(&result->value, value); result->value_raw = *value_raw; zbx_variant_set_none(value_raw); @@ -303,6 +304,8 @@ void pp_format_error(const zbx_variant_t *value, zbx_pp_result_t *results, int r ******************************************************************************/ int pp_error_on_fail(zbx_variant_t *value, const zbx_pp_step_t *step) { + zabbix_log(LOG_LEVEL_CRIT, "DIMBUG In %s()", __func__); + switch (step->error_handler) { case ZBX_PREPROC_FAIL_DISCARD_VALUE: @@ -318,5 +321,7 @@ int pp_error_on_fail(zbx_variant_t *value, const zbx_pp_step_t *step) break; } + zabbix_log(LOG_LEVEL_CRIT, "DIMBUG End of %s():%d", __func__, step->error_handler); + return step->error_handler; } diff --git a/src/libs/zbxpreproc/pp_execute.c b/src/libs/zbxpreproc/pp_execute.c index fdc6d211fcc..5ed42419ad0 100644 --- a/src/libs/zbxpreproc/pp_execute.c +++ b/src/libs/zbxpreproc/pp_execute.c @@ -1242,6 +1242,8 @@ void pp_execute(zbx_pp_context_t *ctx, zbx_pp_item_preproc_t *preproc, zbx_pp_ca if (SUCCEED != pp_execute_step(ctx, cache, um_handle, preproc->hostid, preproc->value_type, value_out, ts, preproc->steps + i, &history_value, &history_ts, config_source_ip)) { + zabbix_log(LOG_LEVEL_CRIT, "DIMBUG %s(): pp_execute_step() failed", __func__); + zbx_variant_copy(&value_raw, value_out); if (ZBX_PREPROC_FAIL_DEFAULT == (action = pp_error_on_fail(value_out, preproc->steps + i))) zbx_variant_clear(&value_raw); @@ -1270,6 +1272,8 @@ void pp_execute(zbx_pp_context_t *ctx, zbx_pp_item_preproc_t *preproc, zbx_pp_ca if (ZBX_VARIANT_ERR == value_out->type) { + zabbix_log(LOG_LEVEL_CRIT, "DIMBUG %s(): value_out->type:ZBX_VARIANT_ERR", __func__); + /* reset preprocessing history in the case of error */ if (NULL != history) {