[ZBXNEXT-3170] Add IP address support in net.if.discovery Created: 2016 Mar 01  Updated: 2016 May 12

Status: Open
Project: ZABBIX FEATURE REQUESTS
Component/s: Agent (G)
Affects Version/s: 3.0.1
Fix Version/s: None

Type: Change Request Priority: Minor
Reporter: Alexander Afonyashin Assignee: Unassigned
Resolution: Unresolved Votes: 5
Labels: interfaces, ipaddress, lld, patch
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File net.c.diff    
Issue Links:
Duplicate
is duplicated by ZBXNEXT-2926 Add {#IFIP} to low discovery network Closed

 Description   

net.if.discovery lacks support of reporting IP addresses for discovered interfaces. Check attached patch. It reports only ipv4 addresses and only on Linux hosts.



 Comments   
Comment by Alexander Afonyashin [ 2016 Mar 01 ]

Patch needs to be improved to add IFADDR6 address reporting. It also skips interfaces without ipv4 addresses.

Comment by Alexander Afonyashin [ 2016 Mar 05 ]

Improved version with ipv4/ipv6/noaddr interface support.

Comment by Alexander Afonyashin [ 2016 Mar 05 ]

$ zabbix_agentd -t net.if.discovery

net.if.discovery                              [s|{"data":[{"{#IFNAME}":"lo","{#IFADDR}":"127.0.0.1","{#IFADDR6}":"::1"},{"{#IFNAME}":"eth0","{#IFADDR}":"X.X.X.X","{#IFADDR6}":"fe80::224:21ff:feXX:XXXX%eth0"},{"{#IFNAME}":"br0","{#IFADDR6}":"fe80::14b6:61ff:feXX:XXXX%br0"}]}]
Comment by Andrey Melnikov [ 2016 Mar 09 ]

real ipv6 config always carry 2 addresses - fe80::xxxx and configured. Which address agent should return? First, second, both?

Comment by Oleksii Zagorskyi [ 2016 Mar 10 ]

The example does't contain {#IFADDR} macro for br0 interface.
It's not very good to include exclude macros. More correctly would be include it but with empty value.
I'm not sure here, but such approach may cause some problems like described in ZBXNEXT-3139

Comment by Oleksii Zagorskyi [ 2016 Mar 10 ]

In duplicated ZBXNEXT-2926 is a concern what to do for interfaces which have multiple IP addresses.

Comment by Glebs Ivanovskis (Inactive) [ 2016 May 12 ]

First of all, please have a look at Zabbix coding guidelines.

Your patch relies heavily on ifaddrs.h. Is it present on all platforms Zabbix supports?

I would suggest converting this patch into a loadable module. It will be easier for people to deploy and use it (no need to apply the patch and recompile Zabbix from sources with every upgrade) and it will be great for gathering more feedback faster.

Generated at Fri Apr 04 15:58:57 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.