Source
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/******************************************************************************
* *
* Purpose: processes new item value *
* *
******************************************************************************/
static void process_value(zbx_uint64_t itemid, zbx_uint64_t *value_ui64, double *value_dbl, zbx_timespec_t *ts,
int ping_result, char *error)
{
zbx_dc_item_t item;
int errcode;
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __func__);
zbx_dc_config_get_items_by_itemids(&item, &itemid, &errcode, 1);
if (SUCCEED != errcode)
goto clean;
if (ITEM_STATUS_ACTIVE != item.status)
goto clean;
if (HOST_STATUS_MONITORED != item.host.status)
goto clean;
if (NOTSUPPORTED == ping_result)
{
item.state = ITEM_STATE_NOTSUPPORTED;
zbx_preprocess_item_value(item.itemid, item.host.hostid, item.value_type, item.flags, NULL, ts,
item.state, error);
}
else
{
AGENT_RESULT value;
zbx_init_agent_result(&value);
if (NULL != value_ui64)
SET_UI64_RESULT(&value, *value_ui64);
else
SET_DBL_RESULT(&value, *value_dbl);
item.state = ITEM_STATE_NORMAL;
zbx_preprocess_item_value(item.itemid, item.host.hostid, item.value_type, item.flags, &value, ts,
item.state, NULL);
zbx_free_agent_result(&value);
}
clean:
zbx_dc_requeue_items(&item.itemid, &ts->sec, &errcode, 1);
zbx_dc_config_clean_items(&item, &errcode, 1);
zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __func__);
}
/******************************************************************************
* *
* Purpose: processes new item values *
* *