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: add item top list to output json *
* *
* Parameters: json - [OUT] the output json *
* field - [IN] the field name *
* items - [IN] a top item list *
* *
******************************************************************************/
static void diag_add_preproc_sequences(struct zbx_json *json, const char *field,
const zbx_vector_pp_top_stats_ptr_t *stats)
{
int i;
zbx_json_addarray(json, field);
for (i = 0; i < stats->values_num; i++)
{
zbx_json_addobject(json, NULL);
zbx_json_adduint64(json, "itemid", stats->values[i]->itemid);
zbx_json_addint64(json, "tasks", stats->values[i]->tasks_num);
zbx_json_close(json);
}
zbx_json_close(json);
}
/******************************************************************************
* *
* Purpose: add requested preprocessing diagnostic information to json data *
* *
* Parameters: jp - [IN] the request *
* json - [IN/OUT] the json to update *
* error - [OUT] error message *
* *
* Return value: SUCCEED - the information was added successfully *
* FAIL - otherwise *
* *
******************************************************************************/
int zbx_diag_add_preproc_info(const struct zbx_json_parse *jp, struct zbx_json *json, char **error)
{
zbx_vector_diag_map_ptr_t tops;
int ret = FAIL;
double time1, time2, time_total = 0;
zbx_uint64_t fields;
zbx_diag_map_t field_map[] = {