Source
zbx_strlog_alloc(LOG_LEVEL_INFORMATION, out, out_alloc, out_offset, "== history cache diagnostic information ==");
/*
** Zabbix
** Copyright (C) 2001-2022 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.
**/
void diag_map_free(zbx_diag_map_t *map)
{
zbx_free(map->name);
zbx_free(map);
}
/******************************************************************************
* *
* Purpose: parse diagnostic section request having json format *
* {"stats":[<field1>,<field2>,...], "top":{<field1>:<limit1>,...}} *
* *
* Parameters: jp - [IN] the request *
* field_map - [IN] a map of supported statistic field names to *
* bitmasks *
* field_mask - [OUT] the bitmask of the requested fields *
* top_views - [OUT] the requested top views *
* error - [OUT] error message *
* *
* Return value: SUCCEED - the request was parsed successfully *
* FAIL - otherwise *
* *
******************************************************************************/
int diag_parse_request(const struct zbx_json_parse *jp, const zbx_diag_map_t *field_map,
zbx_uint64_t *field_mask, zbx_vector_ptr_t *top_views, char **error)
{
struct zbx_json_parse jp_stats;
int ret = FAIL;
const char *pnext = NULL;
char name[ZBX_DIAG_FIELD_MAX + 1], value[MAX_ID_LEN + 1];
zbx_uint64_t value_ui64;
*field_mask = 0;
/* parse requested statistics fields */
if (SUCCEED == zbx_json_brackets_by_name(jp, "stats", &jp_stats))
{