[ZBXNEXT-2765] New attribute in net.if.discovery for zabbix_agentd on Windows Created: 2015 Apr 03 Updated: 2024 Apr 10 Resolved: 2021 Aug 26 |
|
Status: | Closed |
Project: | ZABBIX FEATURE REQUESTS |
Component/s: | Agent (G), Agent2 plugin (N) |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Change Request | Priority: | Minor |
Reporter: | Pavel Zabortsev | Assignee: | Zabbix Development Team |
Resolution: | Duplicate | Votes: | 8 |
Labels: | interfaces, lld, windows | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
zabbix_agentd for Windows |
Attachments: | 2018-03-06_003154.png 2018-03-06_003308.png 2018-03-06_003318.png 2018-03-06_003349.png result3.txt screenshot-1.png | ||||||||||||||||||||||||
Issue Links: |
|
||||||||||||||||||||||||
Team: | Team B | ||||||||||||||||||||||||
Sprint: | Sprint 77 (Jun 2021), Sprint 78 (Jul 2021) |
Description |
Network interfaces on windows systems have several parameters that can be used for naming it: name of interface, name of adapter, alias of interface, maybe etc. In some cases when windows networking is quite complex than using only one physical interface it will be appropriate to use other interface parameters to discovering and monitoring network interfaces. One example was given in zabbix forum here - https://www.zabbix.com/forum/showthread.php?t=48799 I propose to add at least one attribute - name of interface - in network interfaces discovering for windows systems and give the ability to use it in items net.if.in, net.if.out and net.if.total |
Comments |
Comment by Oleksii Zagorskyi [ 2015 Apr 04 ] |
Physical interface name selected because it required for performance counters (I suppose they actually used for net.if.* keys). |
Comment by Pavel Zabortsev [ 2015 Apr 04 ] |
I don't propose to replace currently used {#IFNAME} macro in discovering with intreface name as I thought before. |
Comment by Vitaly Zhuravlev [ 2017 Mar 21 ] |
Also, {#IFNAME} in Windows doesn't look to be always unique: For example, there are two "Intel(R) 82574L Gigabit Network Connection" on Windows7 and Zabbix agent 3.2.4 or 2.4.6 { "data": [{ "{#IFNAME}": "Intel(R) 82574L Gigabit Network Connection" }, { "{#IFNAME}": "Intel(R) 82579LM Gigabit Network Connection-Leutron Vision NDIS6 Filter Driver-0000" }, { "{#IFNAME}": "WAN Miniport (IP)" }, { "{#IFNAME}": "WAN Miniport (IPv6)" }, { "{#IFNAME}": "WAN Miniport (Network Monitor)" }, { "{#IFNAME}": "Intel(R) 82574L Gigabit Network Connection-Leutron Vision NDIS6 Filter Driver-0000" }, { "{#IFNAME}": "TEAM : Team #0" }, { "{#IFNAME}": "TEAM : Team #0 - Intel(R) I210 Gigabit Network Connection #4-WFP LightWeight Filter-0000" }, { "{#IFNAME}": "TEAM : Team #0 - Intel(R) I210 Gigabit Network Connection #3-WFP LightWeight Filter-0000" }, { "{#IFNAME}": "Intel(R) 82579LM Gigabit Network Connection" }, { "{#IFNAME}": "Intel(R) I210 Gigabit Network Connection-Leutron Vision NDIS6 Filter Driver-0000" }, { "{#IFNAME}": "Intel(R) I210 Gigabit Network Connection-QoS Packet Scheduler-0000" }, { "{#IFNAME}": "Intel(R) I210 Gigabit Network Connection" }, { "{#IFNAME}": "Intel(R) I210 Gigabit Network Connection-WFP LightWeight Filter-0000" }, { "{#IFNAME}": "Intel(R) I210 Gigabit Network Connection #2-Leutron Vision NDIS6 Filter Driver-0000" }, { "{#IFNAME}": "Intel(R) I210 Gigabit Network Connection #2" }, { "{#IFNAME}": "Intel(R) I210 Gigabit Network Connection #2-QoS Packet Scheduler-0000" }, { "{#IFNAME}": "Intel(R) I210 Gigabit Network Connection #2-WFP LightWeight Filter-0000" }, { "{#IFNAME}": "TEAM : Team #0 - Intel(R) I210 Gigabit Network Connection #3" }, { "{#IFNAME}": "TEAM : Team #0-WFP LightWeight Filter-0000" }, { "{#IFNAME}": "TEAM : Team #0-QoS Packet Scheduler-0000" }, { "{#IFNAME}": "TEAM : Team #0 - Intel(R) I210 Gigabit Network Connection #4" }, { "{#IFNAME}": "Intel(R) 82574L Gigabit Network Connection - JAI GigE Vision Filter Driver-WFP LightWeight Filter-0000" }, { "{#IFNAME}": "Intel(R) 82574L Gigabit Network Connection - JAI GigE Vision Filter Driver" }, { "{#IFNAME}": "Intel(R) 82579LM Gigabit Network Connection - JAI GigE Vision Filter Driver-WFP LightWeight Filter-0000" }, { "{#IFNAME}": "WAN Miniport (IPv6)-QoS Packet Scheduler-0000" }, { "{#IFNAME}": "WAN Miniport (IP)-QoS Packet Scheduler-0000" }, { "{#IFNAME}": "WAN Miniport (Network Monitor)-QoS Packet Scheduler-0000" }, { "{#IFNAME}": "Intel(R) 82574L Gigabit Network Connection" }, { "{#IFNAME}": "Intel(R) 82579LM Gigabit Network Connection - JAI GigE Vision Filter Driver" }, { "{#IFNAME}": "Intel(R) 82574L Gigabit Network Connection - JAI GigE Vision Filter Driver" }, { "{#IFNAME}": "WAN Miniport (PPPOE)" }, { "{#IFNAME}": "RAS Async Adapter" }, { "{#IFNAME}": "Software Loopback Interface 1" }, { "{#IFNAME}": "Адаптер Microsoft ISATAP" }, { "{#IFNAME}": "WAN Miniport (L2TP)" }, { "{#IFNAME}": "WAN Miniport (SSTP)" }, { "{#IFNAME}": "WAN Miniport (IKEv2)" }, { "{#IFNAME}": "WAN Miniport (PPTP)" }, { "{#IFNAME}": "Адаптер Microsoft ISATAP #2" }, { "{#IFNAME}": "Адаптер Microsoft ISATAP #3" }, { "{#IFNAME}": "Адаптер Microsoft ISATAP #4" }, { "{#IFNAME}": "Адаптер Microsoft ISATAP #5" }, { "{#IFNAME}": "Адаптер Microsoft ISATAP #6" }] } This leads to: So adding something unique in addition to {#IFNAME} would be great |
Comment by Oleksii Zagorskyi [ 2017 Mar 21 ] |
@Vitaly, interesting how is that possible to get interfaces with identical names? |
Comment by Vitaly Zhuravlev [ 2017 Mar 21 ] |
I have at least two PC where this happens. I think it might be Related that bonding(TEAM) is configured on the interface |
Comment by Benjamin RIOUAL [ 2018 Mar 03 ] |
I permit myself to up this thread, until now I had only been able to do it with snmp. It would be nice to have this feature into the agent discovery to uniform the checks |
Comment by Benjamin RIOUAL [ 2018 Mar 06 ] |
I was working on that this evening, I think this gonna fit for you too ! Get-WmiObject win32_networkadapter | Where-Object {$_.NetConnectionID -ne $null} But I had : ServiceName MACAddress AdapterType DeviceID Name NetworkAddresses Speed ----------- ---------- ----------- -------- ---- ---------------- ----- e1iexpress A0:36:9F:A2:1B:40 Ethernet 802.3 1 Intel(R) Ethernet Server Adapter I350-T4 e1iexpress A0:36:9F:A2:1B:41 Ethernet 802.3 2 Intel(R) Ethernet Server Adapter I350-T4 e1iexpress A0:36:9F:A2:1B:42 Ethernet 802.3 3 Intel(R) Ethernet Server Adapter I350-T4 #3 1000000000 e1iexpress A0:36:9F:A2:1B:43 Ethernet 802.3 4 Intel(R) Ethernet Server Adapter I350-T4 #4 1000000000 rt640x64 14:CC:20:00:5D:D7 Ethernet 802.3 5 Realtek PCIe GBE Family Controller NdisImPlatformMp A0:36:9F:A2:1B:41 Ethernet 802.3 8 Microsoft Network Adapter Multiplexor Driver VMSMP A0:36:9F:A2:1B:40 Ethernet 802.3 11 Hyper-V Virtual Ethernet Adapter 1000000000 Now I use : Get-WmiObject MSFT_NetAdapter -Namespace root\standardcimv2 And I get Name InterfaceDescription ---- -------------------- Team1 Microsoft Network Adapter Multiplexor Driver vEthernet (LAN) Hyper-V Virtual Ethernet Adapter WAN Realtek PCIe GBE Family Controller SAN2 Intel(R) Ethernet Server Adapter I350-T4 #4 SAN1 Intel(R) Ethernet Server Adapter I350-T4 #3 LAN2 Intel(R) Ethernet Server Adapter I350-T4 #2 LAN1 Intel(R) Ethernet Server Adapter I350-T4 I made a powershell script with : $Array = "{`"data`":[`n" $Array2 = @() foreach ($Adapter in (Get-WmiObject MSFT_NetAdapter -Namespace root\standardcimv2)) { $Array2 += "{`"{#IFNAME}`":`"" + $Adapter.Name + "`",`"{#IFDESCRIPTION}`":`"" + $Adapter.InterfaceDescription + "`"}`n" } $Array += $Array2 -join(",") $Array += "]}" $Array And just added this line in my config file: UserParameter=windows.net.if.discovery,powershell.exe -executionpolicy bypass -file "C:\Zabbix\Script\net.if.discovery.ps1" Now it works damn great !!! |
Comment by Vitaly Zhuravlev [ 2018 May 24 ] |
FYI, attaching output of Get-WmiObject Win32_NetworkAdapter | Format-List * as you can see, there are two interfaces with the same name Intel(R) 82574L Gigabit Network Connection |
Comment by Vitaly Zhuravlev [ 2018 May 24 ] |
Celizior, thanks for sharing, note thought that MSFT_NetAdapter is only available since Windows 8.
For Win 7, one can use: $Array = "{`"data`":[`n" $Array2 = @() #https://msdn.microsoft.com/en-us/library/aa394216(v=vs.85).aspx #remove -filter NetEnabled=True for extended discovery foreach ($Adapter in (Get-WmiObject Win32_NetworkAdapter -filter NetEnabled=True)) { $Array2 += "{`"{#IFNAME}`":`"" + $Adapter.Name + "`",`"{#IFDESCRIPTION}`":`"" + $Adapter.NetConnectionID + "`"}`n" } $Array += $Array2 -join(",") $Array += "]}" $Array sample output: {"data":[ {"{#IFNAME}":"Qualcomm Atheros AR5B97 Wireless Network Adapter","{#IFDESCRIPTION}":"Беспроводное сетевое соединение"} ,{"{#IFNAME}":"VirtualBox Host-Only Ethernet Adapter #2","{#IFDESCRIPTION}":"VirtualBox Host-Only Network #2"} ,{"{#IFNAME}":"VirtualBox Host-Only Ethernet Adapter #3","{#IFDESCRIPTION}":"VirtualBox Host-Only Network #3"} ,{"{#IFNAME}":"VirtualBox Host-Only Ethernet Adapter","{#IFDESCRIPTION}":"VirtualBox Host-Only Network"} ,{"{#IFNAME}":"VirtualBox Host-Only Ethernet Adapter #4","{#IFDESCRIPTION}":"VirtualBox Host-Only Network #4"} ,{"{#IFNAME}":"VirtualBox Host-Only Ethernet Adapter #5","{#IFDESCRIPTION}":"VirtualBox Host-Only Network #5"} ]} Check for other properties you may add here: https://msdn.microsoft.com/en-us/library/aa394216(v=vs.85).aspx |
Comment by c1support [ 2020 Apr 15 ] |
Hi there, I had a similar issue (documented here: [https://www.zabbix.com/forum/zabbix-troubleshooting-and-problems/398982-lld-network-interfaces-cannot-create-item-item-with-same-key-already-exists|https://www.zabbix.com/forum/zabbix-troubleshooting-and-problems/398982-lld-network-interfaces-cannot-create-item-item-with-same-key-already-exists) for which I was able to find a temporary bugfix thanks to the above work of Benjamin and the wonderful folks at Zabbix Forum.
It feels like Win32_NetworkAdapter is legacy, but I am not a Windows expert. One thing to consider though is the current state of MSFT_NetAdapter: It seems to be legacy, too: https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/hh968170(v%3Dvs.85) |
Comment by Alex Kalimulin [ 2021 May 25 ] |
This is being solved in |