Source
xxxxxxxxxx
int vmware_service_get_perf_counters(zbx_vmware_service_t *service, CURL *easyhandle, zbx_vector_ptr_t *counters, char **error)
/*
** 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.
**/
ZBX_VECTOR_IMPL(uint16, uint16_t)
ZBX_PTR_VECTOR_IMPL(perf_available, zbx_vmware_perf_available_t *)
/*/*/*/*/*[local-name()='refreshRate' and ../*[local-name()='currentSupported']='true']"
#define ZBX_XPATH_ISAGGREGATE() \
"/*/*/*/*/*[local-name()='entity'][../*[local-name()='summarySupported']='true' and " \
"../*[local-name()='currentSupported']='false']"
#define ZBX_XPATH_COUNTERINFO() \
"/*/*/*/*/*/*[local-name()='propSet']/*[local-name()='val']/*[local-name()='PerfCounterInfo']"
/******************************************************************************
* *
* performance counter hashset support functions *
* *
******************************************************************************/
zbx_hash_t vmware_counter_hash_func(const void *data)
{
const zbx_vmware_counter_t *counter = (const zbx_vmware_counter_t *)data;
return ZBX_DEFAULT_STRING_HASH_ALGO(counter->path, strlen(counter->path), ZBX_DEFAULT_HASH_SEED);
}
int vmware_counter_compare_func(const void *d1, const void *d2)
{
const zbx_vmware_counter_t *c1 = (const zbx_vmware_counter_t *)d1;
const zbx_vmware_counter_t *c2 = (const zbx_vmware_counter_t *)d2;
return strcmp(c1->path, c2->path);
}
/******************************************************************************
* *
* performance entities hashset support functions *
* *
******************************************************************************/
zbx_hash_t vmware_perf_entity_hash_func(const void *data)
{
zbx_hash_t seed;
const zbx_vmware_perf_entity_t *entity = (const zbx_vmware_perf_entity_t *)data;
seed = ZBX_DEFAULT_STRING_HASH_ALGO(entity->type, strlen(entity->type), ZBX_DEFAULT_HASH_SEED);
return ZBX_DEFAULT_STRING_HASH_ALGO(entity->id, strlen(entity->id), seed);
}
int vmware_perf_entity_compare_func(const void *d1, const void *d2)
{
int ret;