Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-9619

The value of the available swap of Windows is illegal.

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Won't fix
    • Icon: Blocker Blocker
    • None
    • 2.4.1
    • Agent (G)
    • Windows Server 2012 R2,Zabbix2.4.1

      Zabbix2.2.9 are normally acquired.
      Zabbix2.4.1 the calculation has been changed.

      ?Zabbix2.2.9

      	if (NULL != zbx_GlobalMemoryStatusEx)
      	{
      		ms_ex.dwLength = sizeof(MEMORYSTATUSEX);
      
      		zbx_GlobalMemoryStatusEx(&ms_ex);
      
      		if (NULL == mode || '\0' == *mode || 0 == strcmp(mode, "total"))
      			SET_UI64_RESULT(result, ms_ex.ullTotalPageFile);
      		else if (0 == strcmp(mode, "free"))
      			SET_UI64_RESULT(result, ms_ex.ullAvailPageFile);
      		else if (0 == strcmp(mode, "used"))
      			SET_UI64_RESULT(result, ms_ex.ullTotalPageFile - ms_ex.ullAvailPageFile);
      		else
      			return SYSINFO_RET_FAIL;
      	}
      	else
      	{
      		GlobalMemoryStatus(&ms);
      
      		if (NULL == mode || '\0' == *mode || 0 == strcmp(mode, "total"))
      			SET_UI64_RESULT(result, ms.dwTotalPageFile);
      		else if (0 == strcmp(mode, "free"))
      			SET_UI64_RESULT(result, ms.dwAvailPageFile);
      		else if (0 == strcmp(mode, "used"))
      			SET_UI64_RESULT(result, ms.dwTotalPageFile - ms.dwAvailPageFile);
      		else
      			return SYSINFO_RET_FAIL;
      	}
      

      ?Zabbix2.4.1

      	if (NULL != zbx_GlobalMemoryStatusEx)
      	{
      		ms_ex.dwLength = sizeof(MEMORYSTATUSEX);
      
      		zbx_GlobalMemoryStatusEx(&ms_ex);
      
      		real_swap_total = ms_ex.ullTotalPageFile > ms_ex.ullTotalPhys ?
      				ms_ex.ullTotalPageFile - ms_ex.ullTotalPhys : 0;
      		real_swap_avail = ms_ex.ullAvailPageFile > ms_ex.ullAvailPhys ?
      				ms_ex.ullAvailPageFile - ms_ex.ullAvailPhys : 0;
      	}
      	else
      	{
      		GlobalMemoryStatus(&ms);
      
      		real_swap_total = ms.dwTotalPageFile > ms.dwTotalPhys ?
      				ms.dwTotalPageFile - ms.dwTotalPhys : 0;
      		real_swap_avail = ms.dwAvailPageFile > ms.dwAvailPhys ?
      				ms.dwAvailPageFile - ms.dwAvailPhys : 0;
      	}
      
      	if (real_swap_avail > real_swap_total)
      		real_swap_avail = real_swap_total;
      
      	if (NULL == mode || '\0' == *mode || 0 == strcmp(mode, "total"))
      		SET_UI64_RESULT(result, real_swap_total);
      	else if (0 == strcmp(mode, "free"))
      		SET_UI64_RESULT(result, real_swap_avail);
      	else if (0 == strcmp(mode, "pfree"))
      		SET_DBL_RESULT(result, (real_swap_avail / (double)real_swap_total) * 100.0);
      	else if (0 == strcmp(mode, "used"))
      		SET_UI64_RESULT(result, real_swap_total - real_swap_avail);
      	else
      	{
      		SET_MSG_RESULT(result, zbx_strdup(NULL, "Invalid second parameter."));
      		return SYSINFO_RET_FAIL;
      	}
      

            Unassigned Unassigned
            kazuo.ito Kazuo Ito
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: