Source
zbx_json_addfloat(json, "pfree", 100 * (double)wcache_info.history_free / (double)wcache_info.history_total);
/*
** Copyright (C) 2001-2024 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/>.
**/
static zbx_get_program_type_f get_program_type_cb;
static zbx_vector_stats_ext_func_t stats_ext_funcs;
static zbx_vector_stats_ext_func_t stats_data_funcs;
static zbx_zabbix_stats_procinfo_func_t procinfo_funcs[ZBX_PROCESS_TYPE_COUNT];
ZBX_PTR_VECTOR_IMPL(stats_ext_func, zbx_stats_ext_func_entry_t *)
void zbx_init_library_stats(zbx_get_program_type_f get_program_type)
{
get_program_type_cb = get_program_type;
zbx_vector_stats_ext_func_create(&stats_data_funcs);
zbx_vector_stats_ext_func_create(&stats_ext_funcs);
}
/******************************************************************************
* *
* Purpose: register callback to add information to main element *
* *
* Parameters: stats_ext_get_cb - [IN] statistics extension callback *
* arg - [IN] argument passed to callback *
* *
******************************************************************************/
void zbx_register_stats_ext_func(zbx_zabbix_stats_ext_get_func_t stats_ext_get_cb, const void *arg)
{
zbx_stats_ext_func_entry_t *entry;
entry = (zbx_stats_ext_func_entry_t *)zbx_malloc(NULL, sizeof(zbx_stats_ext_func_entry_t));
entry->arg = arg;
entry->stats_ext_get_cb = stats_ext_get_cb;
zbx_vector_stats_ext_func_append(&stats_ext_funcs, entry);
}
/******************************************************************************
* *
* Purpose: register callback to add information to data sub-element *
* *
* Parameters: stats_ext_get_cb - [IN] statistics extension callback *
* arg - [IN] argument passed to callback *