ZABBIX BUGS AND ISSUES
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-7875

"Server 2012 R2" detected incorrectly as "Server 2012", core number is different.

    Details

      Description

      1. zabbix_get -s 10.10.10.10 -k system.uname
        Windows 2012R2COREFSZ 6.2.9200 Microsoft Windows Server 2012 Standard Edition x64
      1. zabbix_get -s 10.10.10.10 -k agent.version
        2.2.0

      On windows cmd I can see this:
      C:\Users\>ver
      Microsoft Windows [Version 6.3.9600]
      Attached image confirms this.

      Also I cannot understand how zabbix agent returns "6.2.9200" in its response instead of "6.3.9600"
      According to code looks like it should be returned as is.

      We had similar cases in the past, for example ZBX-6040
      As this is not the last windows version I have a suggestion - what if we change code and for new unknown windows versions will return something like "Unknown" instead of latest known version ("Server 2012" in our case) ?
      It will be more correct I believe.

        Activity

        Hide
        Alexander Vladishev added a comment -

        Fixed in the development branch svn://svn.zabbix.com/branches/dev/ZBX-7875

        Show
        Alexander Vladishev added a comment - Fixed in the development branch svn://svn.zabbix.com/branches/dev/ZBX-7875
        Hide
        Oleksiy Zagorskyi added a comment - - edited

        (3) According to code changes I guess zabbix agent will be able now to return correct uname even for future unknown windows versions.
        Is that correct?

        Then it worth to add to whats_new documentation page.

        Nikolajs Agafonovs i don't think so. This is just bug correction not new feature. No need in additional documentation. RESOLVED

        Oleksiy Zagorskyi well, I can accept your point of view about documentation.
        But let me know - am I correct about first question?

        Nikolajs Agafonovs yes, you are correct about detection of future windows versions. This function will work till microsoft change version key location in windows registry. Let's hope they will not do that

        Oleksiy Zagorskyi Thanks, CLOSED.

        Show
        Oleksiy Zagorskyi added a comment - - edited (3) According to code changes I guess zabbix agent will be able now to return correct uname even for future unknown windows versions. Is that correct? Then it worth to add to whats_new documentation page. Nikolajs Agafonovs i don't think so. This is just bug correction not new feature. No need in additional documentation. RESOLVED Oleksiy Zagorskyi well, I can accept your point of view about documentation. But let me know - am I correct about first question? Nikolajs Agafonovs yes, you are correct about detection of future windows versions. This function will work till microsoft change version key location in windows registry. Let's hope they will not do that Oleksiy Zagorskyi Thanks, CLOSED.
        Hide
        Nikolajs Agafonovs added a comment -

        Available in development branch svn://svn.zabbix.com/branches/dev/ZBX-7875

        Show
        Nikolajs Agafonovs added a comment - Available in development branch svn://svn.zabbix.com/branches/dev/ZBX-7875
        Hide
        Andris Zeila added a comment - - edited

        (6) Instead of declaring windows registry paths and keys as char* and converting to unicode with zbx_utf8_to_unicode() function it would be better to declare them as LPCTSTR and use TEXT() macro for initialization.

        Nikolajs Agafonovs RESOLVED in r43964

        Andris Zeila CLOSED

        Show
        Andris Zeila added a comment - - edited (6) Instead of declaring windows registry paths and keys as char* and converting to unicode with zbx_utf8_to_unicode() function it would be better to declare them as LPCTSTR and use TEXT() macro for initialization. Nikolajs Agafonovs RESOLVED in r43964 Andris Zeila CLOSED
        Hide
        Andris Zeila added a comment - - edited

        (7) The zbx_unicode_to_utf8() function returns allocated memory which must be freed by the caller.

        Nikolajs Agafonovs RESOLVED in r43935

        Andris Zeila CLOSED

        Show
        Andris Zeila added a comment - - edited (7) The zbx_unicode_to_utf8() function returns allocated memory which must be freed by the caller. Nikolajs Agafonovs RESOLVED in r43935 Andris Zeila CLOSED
        Hide
        Andris Zeila added a comment - - edited

        (8) The OS_WIN_VERSION structure should be named closer to Zabbix conventions, something like zbx_win_version_t for example. And it would be better to store its members as dynamically allocated strings - they are stored as strings in registry and there are no guarantees that some of those values will not exceed the hardcoded limits in future.

        Also in this case a function for structure cleanup should be added.

        Nikolajs Agafonovs RESOLVED in r43926

        Nikolajs Agafonovs win version as pointers array RESOLVED in r44078

        Andris Zeila CLOSED

        Show
        Andris Zeila added a comment - - edited (8) The OS_WIN_VERSION structure should be named closer to Zabbix conventions, something like zbx_win_version_t for example. And it would be better to store its members as dynamically allocated strings - they are stored as strings in registry and there are no guarantees that some of those values will not exceed the hardcoded limits in future. Also in this case a function for structure cleanup should be added. Nikolajs Agafonovs RESOLVED in r43926 Nikolajs Agafonovs win version as pointers array RESOLVED in r44078 Andris Zeila CLOSED
        Hide
        Andris Zeila added a comment - - edited

        (9) Instead of iterating they keys in loop it would be simpler to have a helper function for reading key value from registry, something like:

        static char *registry_read_value(HKEY key, LPCTSTR value_name);

        This function would determine size of the buffer required to store value, allocate buffer to store value, read value, convert value to unicode, free the allocated buffer and return the converted value.

        Nikolajs Agafonovs RESOLVED in r43964

        Andris Zeila CLOSED

        Show
        Andris Zeila added a comment - - edited (9) Instead of iterating they keys in loop it would be simpler to have a helper function for reading key value from registry, something like: static char *registry_read_value(HKEY key, LPCTSTR value_name); This function would determine size of the buffer required to store value, allocate buffer to store value, read value, convert value to unicode, free the allocated buffer and return the converted value. Nikolajs Agafonovs RESOLVED in r43964 Andris Zeila CLOSED
        Hide
        Andris Zeila added a comment - - edited

        (10) On Windows 2000 the new zabbix_agent system.uname returns:

        Windows W2000PRO 5.0.1.511.1 () (Obsolete data - do not use) Microsoft Windows 2000 Service Pack 4 x86
        

        While the original version was:

        Windows W2000PRO 5.0.2195 Microsoft Windows 2000 Professional Service Pack 4 x86
        

        By looking at registry it appears that the correct registry value is CurrentBuildNumber rather than BuildNumber. However we need to check it on other systems and find if there is some information about Microsoft\Windows NT\CurrentVersion resgistry values.

        Nikolajs Agafonovs RESOLVED in r44437

        Andris Zeila Upon deeper investigation was found that the Windows name/edition taken from registry does not exactly match the Windows name/edition generated by the current agent version. The only way to ensure compatibility is to replace GetVersionEx() with custom function which will retrieve the required data from registry.

        The following OSVERSIONINFOEX structure fields are used by agent to determine windows version/edition - dwMajorVersion, wMinorVersion, dwBuildNumber, wProductType, wSuiteMask.

        Version numbers can be found at registry key HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion values CurrentVersion, CurrentBuildNumber

        Product type and suite informaton can be found at registry key HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions values PeoductType, ProductSuite.

        Some information how the ProductOptions values can be mapped to wProductType, wSuite mask fields:
        http://support.microsoft.com/kb/152078
        http://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/ex/exinit/productsuite.htm

        Nikolajs Agafonovs RESOLVED in r44666

        Andris Zeila CLOSED

        Show
        Andris Zeila added a comment - - edited (10) On Windows 2000 the new zabbix_agent system.uname returns: Windows W2000PRO 5.0.1.511.1 () (Obsolete data - do not use) Microsoft Windows 2000 Service Pack 4 x86 While the original version was: Windows W2000PRO 5.0.2195 Microsoft Windows 2000 Professional Service Pack 4 x86 By looking at registry it appears that the correct registry value is CurrentBuildNumber rather than BuildNumber. However we need to check it on other systems and find if there is some information about Microsoft\Windows NT\CurrentVersion resgistry values. Nikolajs Agafonovs RESOLVED in r44437 Andris Zeila Upon deeper investigation was found that the Windows name/edition taken from registry does not exactly match the Windows name/edition generated by the current agent version. The only way to ensure compatibility is to replace GetVersionEx() with custom function which will retrieve the required data from registry. The following OSVERSIONINFOEX structure fields are used by agent to determine windows version/edition - dwMajorVersion, wMinorVersion, dwBuildNumber, wProductType, wSuiteMask. Version numbers can be found at registry key HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion values CurrentVersion, CurrentBuildNumber Product type and suite informaton can be found at registry key HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions values PeoductType, ProductSuite. Some information how the ProductOptions values can be mapped to wProductType, wSuite mask fields: http://support.microsoft.com/kb/152078 http://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/ex/exinit/productsuite.htm Nikolajs Agafonovs RESOLVED in r44666 Andris Zeila CLOSED
        Hide
        Andris Zeila added a comment -

        Successfully tested

        Show
        Andris Zeila added a comment - Successfully tested
        Hide
        Alexander Vladishev added a comment -

        Fixed in pre-2.0.13 r45421, pre-2.2.4 r45422 and pre-2.3.0 (trunk) r45429.

        Show
        Alexander Vladishev added a comment - Fixed in pre-2.0.13 r45421, pre-2.2.4 r45422 and pre-2.3.0 (trunk) r45429.
        Hide
        Alexander Vladishev added a comment - - edited

        (11) The changes can cause Windows agent crash

        SET_MSG_RESULT(result, "cannot retrieve system version");

        After a calling of free_result() agent will crashed.

        Alexander Vladishev RESOLVED in ^/branches/2.0 r45785; ^/branches/2.2 r45786.

        Andris Zeila CLOSED

        Show
        Alexander Vladishev added a comment - - edited (11) The changes can cause Windows agent crash SET_MSG_RESULT(result, "cannot retrieve system version" ); After a calling of free_result() agent will crashed. Alexander Vladishev RESOLVED in ^/branches/2.0 r45785; ^/branches/2.2 r45786. Andris Zeila CLOSED
        Hide
        Andris Zeila added a comment -

        Successfully tested

        Show
        Andris Zeila added a comment - Successfully tested

          People

          • Assignee:
            Unassigned
            Reporter:
            Oleksiy Zagorskyi
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: