int check_vcenter_hv_status(AGENT_REQUEST *request, const char *username, const char *password, AGENT_RESULT *result) { int ret; ret = get_vcenter_stat(request, username, password, ZBX_OPT_XPATH, ZBX_XPATH_LN2("val", "overallStatus"), result); if (SYSINFO_RET_OK == ret && NULL != GET_STR_RESULT(result)) { if (0 == strcmp(result->str, "gray")) SET_UI64_RESULT(result, 0); else if (0 == strcmp(result->str, "green")) SET_UI64_RESULT(result, 1); else if (0 == strcmp(result->str, "yellow")) SET_UI64_RESULT(result, 2); else if (0 == strcmp(result->str, "red")) SET_UI64_RESULT(result, 3); else ret = SYSINFO_RET_FAIL; UNSET_STR_RESULT(result); } return ret; }
void free_result(AGENT_RESULT *result) { UNSET_UI64_RESULT(result); UNSET_DBL_RESULT(result); UNSET_STR_RESULT(result); UNSET_TEXT_RESULT(result); UNSET_LOG_RESULT(result); UNSET_MSG_RESULT(result); }
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; }