Created
March 28, 2014 06:04
-
-
Save higebu/9826313 to your computer and use it in GitHub Desktop.
Fix ZBX-7721 https://support.zabbix.com/browse/ZBX-7721
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -u -r zabbix-2.2.2.orig/src/zabbix_server/vmware/vmware.c zabbix-2.2.2/src/zabbix_server/vmware/vmware.c | |
--- zabbix-2.2.2.orig/src/zabbix_server/vmware/vmware.c 2014-02-12 18:04:36.000000000 +0900 | |
+++ zabbix-2.2.2/src/zabbix_server/vmware/vmware.c 2014-03-28 13:51:08.285732065 +0900 | |
@@ -1944,9 +1944,22 @@ | |
"</ns0:RetrievePropertiesEx>" \ | |
ZBX_POST_VSPHERE_FOOTER | |
+# define ZBX_POST_VCENTER_HV_LIST_CONTINUE \ | |
+ ZBX_POST_VSPHERE_HEADER \ | |
+ "<ns0:ContinueRetrievePropertiesEx xsi:type=\"ns0:ContinueRetrievePropertiesExRequestType\">" \ | |
+ "<ns0:_this type=\"PropertyCollector\">propertyCollector</ns0:_this>" \ | |
+ "<ns0:token>%s</ns0:token>" \ | |
+ "</ns0:ContinueRetrievePropertiesEx>" \ | |
+ ZBX_POST_VSPHERE_FOOTER | |
+ | |
+# define ZBX_XPATH_RETRIEVE_PROPERTIES_TOKEN \ | |
+ "/*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='RetrievePropertiesExResponse']" \ | |
+ "/*[local-name()='returnval']/*[local-name()='token']" | |
+ | |
const char *__function_name = "vmware_service_get_hv_list"; | |
int err, opt, ret = FAIL; | |
+ char tmp[MAX_STRING_LEN], *token; | |
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name); | |
@@ -1972,6 +1985,37 @@ | |
goto out; | |
zbx_xml_read_values(page.data, "//*[@type='HostSystem']", hvs); | |
+ | |
+ if (NULL != (token = zbx_xml_read_value(page.data, ZBX_XPATH_RETRIEVE_PROPERTIES_TOKEN))) | |
+ { | |
+ zabbix_log(LOG_LEVEL_DEBUG, "%s() token: %s", __function_name, token); | |
+ do | |
+ { | |
+ zbx_snprintf(tmp, sizeof(tmp), ZBX_POST_VCENTER_HV_LIST_CONTINUE, token); | |
+ | |
+ if (CURLE_OK != (err = curl_easy_setopt(easyhandle, opt = CURLOPT_POSTFIELDS, tmp))) | |
+ { | |
+ *error = zbx_dsprintf(*error, "Cannot set cURL option [%d]: %s", opt, curl_easy_strerror(err)); | |
+ goto out; | |
+ } | |
+ | |
+ page.offset = 0; | |
+ | |
+ if (CURLE_OK != (err = curl_easy_perform(easyhandle))) | |
+ { | |
+ *error = zbx_strdup(*error, curl_easy_strerror(err)); | |
+ goto out; | |
+ } | |
+ | |
+ zabbix_log(LOG_LEVEL_DEBUG, "%s() page.data:'%s'", __function_name, page.data); | |
+ if (NULL != (*error = zbx_xml_read_value(page.data, ZBX_XPATH_LN1("faultstring")))) | |
+ goto out; | |
+ | |
+ zbx_xml_read_values(page.data, "//*[@type='HostSystem']", hvs); | |
+ | |
+ token = zbx_xml_read_value(page.data, ZBX_XPATH_RETRIEVE_PROPERTIES_TOKEN); | |
+ } while (NULL != token); | |
+ } | |
} | |
else | |
{ |
Author
higebu
commented
Mar 28, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment