Source
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/******************************************************************************
* *
* 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_sequence_stats_ptr_t *sequences)
{
int i;
zbx_json_addarray(json, field);
for (i = 0; i < sequences->values_num; i++)
{
zbx_json_addobject(json, NULL);
zbx_json_adduint64(json, "itemid", sequences->values[i]->itemid);
zbx_json_addint64(json, "tasks", sequences->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)
{