[ZBX-2983] Auto registration: host ip always 127.0.0.1 Created: 2010 Sep 07  Updated: 2017 May 30  Resolved: 2011 Mar 24

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: None
Affects Version/s: 1.8.3
Fix Version/s: 1.9.1 (alpha)

Type: Incident report Priority: Major
Reporter: Thomas Mueller Assignee: Unassigned
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File include-comms.h.diff     File src-zabbix_server-operations.c.diff     File src_libs_zbxcomms_comms.c.diff    

 Description   

The following Action -> Auto-Registration rule

Actions: Link to template "Basic-Check" / Add to group "New" / Add host
Conditions: none

creates every host with 127.0.0.1 as IP address.

It should populate the real address of the host.

It should provide a option to set the IP address as default connect method.



 Comments   
Comment by Alexander Fedulov [ 2010 Nov 02 ]

This is a crucial issue for us as well, as we currently estimate Zabbix as a candidate for monitoring solution in a big project, related to Cloud Computing. The ability to correctly register newly instantiated VMs with their real IP addresses is essential.

Comment by Gavin Brown [ 2011 Mar 24 ]

I have been looking into this an have a working solution against the zabbix 1.8.4 code base. The code which adds servers during auto-registration simply does not attempt to workout an ip address for registered hosts.
I made two main changes to the code;
i) added a new function in src/libs/zbxcomms/comms.c called zbx_getip_by_host, which is simply a reverse of the existing zbx_gethost_by_ip. i.e. given a hostname it will attempt to resolve an ip address. Note: At this stage I have only coded a function for #defined(HAVE_IPV6). For completeness one should be code for the more legacy gethostbyname function. Also note that I haven't looked at any windows code for this.
ii) updated the add_discovered_host function in src/zabbix_server/operations.c to attempt to get an ip address for the new host, before performing the insert into the hosts table. Note: this does not yet fall back to 127.0.0.1 if no host name is discovered, should this been the desired outcome?

Attached are 3 svn diffs: src/zabbix_server/operations.c, src/libs/zbxcomms/comms.c, include/comms.h

I hope this helps?

Comment by Gavin Brown [ 2011 Mar 24 ]

Svn diff files of the changes I've made to date to rectify this issue.

Comment by Gavin Brown [ 2011 Mar 24 ]

Oh and there's still a couple of my extra log messages that can be cleaned up.

Comment by Gavin Brown [ 2011 Mar 24 ]

This seems to be a duplicate of: ZBXNEXT-201

Comment by richlv [ 2011 Mar 24 ]

i believe this was implemented as ZBXNEXT-558

patches might still be useful for those who desperately need something comparable for 1.8, though

Comment by C [ 2013 Jul 23 ]

This is not fixed as I am on 2.0.6 and this is still happening even with SourceIP= and ListenIP= are defined on the agent. This ticket was closed almost 2 years ago with no resolution and its frustration as the forums have hundreds of unanswered questions.

Comment by C [ 2013 Jul 24 ]

So why is this still happening?

Comment by C [ 2013 Jul 26 ]

Anyone care to comment? Why are tickets being closed that are not resolved?

Generated at Tue Mar 18 19:27:05 EET 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.