static void diag_add_lld_items(struct zbx_json *json, const char *field, const zbx_vector_uint64_pair_t *items)
#include "zbxcachevalue.h"
#include "../lld/lld_protocol.h"
#define ZBX_DIAG_LLD_RULES 0x00000001
#define ZBX_DIAG_LLD_VALUES 0x00000002
#define ZBX_DIAG_LLD_SIMPLE (ZBX_DIAG_LLD_RULES | \
#define ZBX_DIAG_ALERTING_ALERTS 0x00000001
#define ZBX_DIAG_ALERTING_SIMPLE (ZBX_DIAG_ALERTING_ALERTS)
static int diag_valuecache_item_compare_values(const void *d1, const void *d2)
zbx_vc_item_stats_t *i1 = *(zbx_vc_item_stats_t **)d1;
zbx_vc_item_stats_t *i2 = *(zbx_vc_item_stats_t **)d2;
return i2->values_num - i1->values_num;
static int diag_valuecache_item_compare_hourly(const void *d1, const void *d2)
zbx_vc_item_stats_t *i1 = *(zbx_vc_item_stats_t **)d1;
zbx_vc_item_stats_t *i2 = *(zbx_vc_item_stats_t **)d2;
return i2->hourly_num - i1->hourly_num;
static void diag_valuecache_add_items(struct zbx_json *json, const char *field, zbx_vc_item_stats_t **items,
zbx_json_addarray(json, field);
for (i = 0; i < items_num; i++)
zbx_json_addobject(json, NULL);
zbx_json_addint64(json, "itemid", items[i]->itemid);
zbx_json_addint64(json, "values", items[i]->values_num);
zbx_json_addint64(json, "request.values", items[i]->hourly_num);
#define ZBX_DIAG_VALUECACHE_ITEMS 0x00000001
#define ZBX_DIAG_VALUECACHE_VALUES 0x00000002
#define ZBX_DIAG_VALUECACHE_MODE 0x00000004
#define ZBX_DIAG_VALUECACHE_MEMORY 0x00000008
#define ZBX_DIAG_VALUECACHE_SIMPLE (ZBX_DIAG_VALUECACHE_ITEMS | \
ZBX_DIAG_VALUECACHE_VALUES | \
ZBX_DIAG_VALUECACHE_MODE)