Source
static int vmware_service_get_counter_value_by_id(zbx_vmware_service_t *service, const char *type, const char *id,
/*
** 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.
**/
static int vmware_set_powerstate_result(AGENT_RESULT *result)
{
int ret = SYSINFO_RET_OK;
if (NULL != GET_STR_RESULT(result))
{
if (0 == strcmp(result->str, "poweredOff"))
SET_UI64_RESULT(result, 0);
else if (0 == strcmp(result->str, "poweredOn"))
SET_UI64_RESULT(result, 1);
else if (0 == strcmp(result->str, "suspended"))
SET_UI64_RESULT(result, 2);
else
ret = SYSINFO_RET_FAIL;
UNSET_STR_RESULT(result);
}
return ret;
}
/******************************************************************************
* *
* Function: hv_get *
* *
* Purpose: return pointer to Hypervisor data from hashset with uuid *
* *
* Parameters: hvs - [IN] the hashset with all Hypervisors *
* uuid - [IN] the uuid of Hypervisor *
* *
* Return value: zbx_vmware_hv_t* - the operation has completed successfully *
* NULL - the operation has failed *
* *
******************************************************************************/
static zbx_vmware_hv_t *hv_get(zbx_hashset_t *hvs, const char *uuid)
{
zbx_vmware_hv_t *hv, hv_local = {.uuid = (char *)uuid};
zabbix_log(LOG_LEVEL_DEBUG, "In %s() uuid:'%s'", __func__, uuid);
hv = (zbx_vmware_hv_t *)zbx_hashset_search(hvs, &hv_local);
zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%p", __func__, (void *)hv);
return hv;
}
/******************************************************************************
* *
* Function: ds_get *
* *
* Purpose: return pointer to Datastore data from vector with id *