diff options
author | Andris Zeila <andris.zeila@zabbix.com> | 2021-04-29 11:54:18 +0300 |
---|---|---|
committer | Andris Zeila <andris.zeila@zabbix.com> | 2021-04-29 11:54:33 +0300 |
commit | cfd64e3216eaec86f4f6a63aff96e4b27de60a12 (patch) | |
tree | 69c2db6e77c36785174b0b228f491ec04599ef3a /src | |
parent | e9a0cdbc4f316ef08b5baa9b59a13b2508aa9ee6 (diff) |
........S. [ZBXNEXT-6452] removed unused function and redundant variable assignment
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/zbxdbhigh/host.c | 2 | ||||
-rw-r--r-- | src/zabbix_server/poller/checks_aggregate.c | 143 |
2 files changed, 0 insertions, 145 deletions
diff --git a/src/libs/zbxdbhigh/host.c b/src/libs/zbxdbhigh/host.c index 911fc2100dd..d6fffadc292 100644 --- a/src/libs/zbxdbhigh/host.c +++ b/src/libs/zbxdbhigh/host.c @@ -1833,8 +1833,6 @@ static int DBcopy_trigger_to_host(zbx_uint64_t *new_triggerid, zbx_uint64_t *cur { zbx_eval_context_t ctx, ctx_r; - res = SUCCEED; - *new_triggerid = DBget_maxid("triggers"); *cur_triggerid = 0; diff --git a/src/zabbix_server/poller/checks_aggregate.c b/src/zabbix_server/poller/checks_aggregate.c index 7c38358ef04..ba4d9178a98 100644 --- a/src/zabbix_server/poller/checks_aggregate.c +++ b/src/zabbix_server/poller/checks_aggregate.c @@ -510,146 +510,3 @@ clean1: return ret; } - -/****************************************************************************** - * * - * Function: get_value_aggregate * - * * - * Purpose: retrieve data from Zabbix server (aggregate items) * - * * - * Parameters: item - item we are interested in * - * * - * Return value: SUCCEED - data successfully retrieved and stored in result * - * and result_str (as string) * - * NOTSUPPORTED - requested item is not supported * - * * - * Author: Alexei Vladishev * - * * - ******************************************************************************/ -int get_value_aggregate(const DC_ITEM *item, AGENT_RESULT *result) -{ - AGENT_REQUEST request; - int ret = NOTSUPPORTED; - const char *tmp, *groups, *itemkey, *funcp = NULL; - int grp_func, item_func, params_num; - zbx_vector_str_t group_names; - - zabbix_log(LOG_LEVEL_DEBUG, "In %s() key:'%s'", __func__, item->key_orig); - - init_request(&request); - zbx_vector_str_create(&group_names); - - if (ITEM_VALUE_TYPE_FLOAT != item->value_type && ITEM_VALUE_TYPE_UINT64 != item->value_type) - { - SET_MSG_RESULT(result, zbx_strdup(NULL, "Value type must be Numeric for aggregate items")); - goto out; - } - - if (SUCCEED != parse_item_key(item->key, &request)) - { - SET_MSG_RESULT(result, zbx_strdup(NULL, "Invalid item key format.")); - goto out; - } - - if (0 == strcmp(get_rkey(&request), "grpmin")) - { - grp_func = ZBX_VALUE_FUNC_MIN; - } - else if (0 == strcmp(get_rkey(&request), "grpavg")) - { - grp_func = ZBX_VALUE_FUNC_AVG; - } - else if (0 == strcmp(get_rkey(&request), "grpmax")) - { - grp_func = ZBX_VALUE_FUNC_MAX; - } - else if (0 == strcmp(get_rkey(&request), "grpsum")) - { - grp_func = ZBX_VALUE_FUNC_SUM; - } - else - { - SET_MSG_RESULT(result, zbx_strdup(NULL, "Invalid item key.")); - goto out; - } - - params_num = get_rparams_num(&request); - - if (3 > params_num || params_num > 4) - { - SET_MSG_RESULT(result, zbx_strdup(NULL, "Invalid number of parameters.")); - goto out; - } - - groups = get_rparam(&request, 0); - itemkey = get_rparam(&request, 1); - tmp = get_rparam(&request, 2); - - if (REQUEST_PARAMETER_TYPE_ARRAY == get_rparam_type(&request, 0)) - { - int i, groups_num; - char *group; - zbx_request_parameter_type_t type; - - groups_num = num_param(groups); - - for (i = 1; i <= groups_num; i++) - { - if (NULL == (group = get_param_dyn(groups, i, &type))) - continue; - - zbx_vector_str_append(&group_names, group); - - if (REQUEST_PARAMETER_TYPE_STRING != type) - { - SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Invalid host group list: %s", groups)); - goto out; - } - } - } - else - zbx_vector_str_append(&group_names, zbx_strdup(NULL, groups)); - - zabbix_log(LOG_LEVEL_DEBUG, "Host groups: '%s', Item key: '%s', Item function: '%s'", groups, itemkey, tmp); - - if (0 == strcmp(tmp, "min")) - item_func = ZBX_VALUE_FUNC_MIN; - else if (0 == strcmp(tmp, "avg")) - item_func = ZBX_VALUE_FUNC_AVG; - else if (0 == strcmp(tmp, "max")) - item_func = ZBX_VALUE_FUNC_MAX; - else if (0 == strcmp(tmp, "sum")) - item_func = ZBX_VALUE_FUNC_SUM; - else if (0 == strcmp(tmp, "count")) - item_func = ZBX_VALUE_FUNC_COUNT; - else if (0 == strcmp(tmp, "last")) - item_func = ZBX_VALUE_FUNC_LAST; - else - { - SET_MSG_RESULT(result, zbx_strdup(NULL, "Invalid third parameter.")); - goto out; - } - - if (4 == params_num) - { - funcp = get_rparam(&request, 3); - } - else if (3 == params_num && ZBX_VALUE_FUNC_LAST != item_func) - { - SET_MSG_RESULT(result, zbx_strdup(NULL, "Invalid number of parameters.")); - goto out; - } - - if (SUCCEED != evaluate_aggregate(item, result, grp_func, &group_names, itemkey, item_func, funcp)) - goto out; - - ret = SUCCEED; -out: - zbx_vector_str_clear_ext(&group_names, zbx_str_free); - zbx_vector_str_destroy(&group_names); - free_request(&request); - - zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%s", __func__, zbx_result_string(ret)); - - return ret; -} |