[ZBX-7875] "Server 2012 R2" detected incorrectly as "Server 2012", core number is different. Created: 2014 Feb 26  Updated: 2017 May 30  Resolved: 2014 May 23

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: 2.2.2
Fix Version/s: 2.0.13rc1, 2.2.4rc1, 2.3.0

Type: Incident report Priority: Major
Reporter: Oleksii Zagorskyi Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: uname, windows
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File 2012R2.png    
Issue Links:
Duplicate

 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.



 Comments   
Comment by Alexander Vladishev [ 2014 Mar 18 ]

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

Comment by Oleksii Zagorskyi [ 2014 Mar 18 ]

(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

zalex_ua 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

zalex_ua Thanks, CLOSED.

Comment by Nikolajs Agafonovs (Inactive) [ 2014 Mar 19 ]

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

Comment by Andris Zeila [ 2014 Mar 31 ]

(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

wiper CLOSED

Comment by Andris Zeila [ 2014 Mar 31 ]

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

nikolajs.agafonovs RESOLVED in r43935

wiper CLOSED

Comment by Andris Zeila [ 2014 Mar 31 ]

(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

wiper CLOSED

Comment by Andris Zeila [ 2014 Mar 31 ]

(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

wiper CLOSED

Comment by Andris Zeila [ 2014 Apr 14 ]

(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

wiper 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

wiper CLOSED

Comment by Andris Zeila [ 2014 Apr 28 ]

Successfully tested

Comment by Alexander Vladishev [ 2014 May 13 ]

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

Comment by Alexander Vladishev [ 2014 May 23 ]

(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.

sasha RESOLVED in ^/branches/2.0 r45785; ^/branches/2.2 r45786.

wiper CLOSED

Comment by Andris Zeila [ 2014 May 23 ]

Successfully tested

Generated at Sat Apr 27 05:44:35 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.