[ZBX-2336] Empty hostname on autoregistration if server hostname > 15 chars. Created: 2010 Apr 19  Updated: 2017 May 30  Resolved: 2010 Jun 02

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: 1.8.2
Fix Version/s: 1.8.3, 1.9.0 (alpha)

Type: Incident report Priority: Major
Reporter: Tom de Waha Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows Server 2008 Datacenter Edition x64



 Description   

Server configured for autoregistration.
Hostname field left blank in Agent config.
If the hostname is over 15 characters long, the agent will register with an empty hostname. Also system.hostname returns an empty string.

During installation Windows 2008 DC automatically generates a hostname > 15 characters.



 Comments   
Comment by richlv [ 2010 Apr 19 ]

just a note : seems to work fine on linux & on the server side

Comment by Tom de Waha [ 2010 Apr 19 ]

I think it may have to do with where you take the hostname info from. Netbios for example does not support hostnames over 15 characters. I'm right now testing this issues on other windows versions.

Comment by Tom de Waha [ 2010 Apr 19 ]

Tested on Windows Server 2003 x86, the problem is the same.

Zabbix_agentd.log:

For key [system.hostname] received value []

Comment by Tom de Waha [ 2010 Apr 21 ]

Is it possible that you compile against an old version of the win32 sdk ?
The Agent takes the computer name length from MAX_COMPUTERNAME_LENGTH in the win32 sdk which was 15 but is now 31.

system.c:

#if defined(_WINDOWS)
/* NOTE: The buffer size should be large enough to contain MAX_COMPUTERNAME_LENGTH + 1 characters.*/
TCHAR wide_buffer[MAX_COMPUTERNAME_LENGTH + 1];
DWORD dwSize = MAX_COMPUTERNAME_LENGTH;

if (0 == GetComputerName(wide_buffer, &dwSize))
*wide_buffer = '\0';

Comment by Aleksandrs Saveljevs [ 2010 Jun 07 ]

Fixed in pre-1.8.3 in r12575.

Generated at Fri Apr 26 01:26:23 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.