Ad Widget

Collapse

LLD network interfaces: "Cannot create item: item with same key already exists"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • c1support
    Member
    • Apr 2020
    • 47

    #1

    LLD network interfaces: "Cannot create item: item with same key already exists"

    Dear friends

    First off, I only started discovery Zabbix some two months ago and did it all self-taught, but so far I am very impressed with what you can achieve with this piece of beauty.
    I am currently struggling with LLD of my network interfaces https://www.zabbix.com/documentation/current/manual/discovery/low_level_discovery/network_interfaces.
    However, I must admit that I am slightly confused why I am getting WMI info also (see below) - but this is probably not the biggest issue.

    Setup:
    We have the following setup (only relevant parts):
    - Hardware: Fujitsu PRIMERGY RX2530 M2 => 6 Ethernet Interfaces used
    - Host-OS: Windows Server 2016
    => Zabbix agent (passive)
    => iRMC (-> IPMI)
    => Hyper-V
    - Guest-OS: Ubuntu 18.04
    => Zabbix 4.4.7
    => using "Template Module Windows network by Zabbix agent"


    When looking at Windows Server 2016: Control Panel => Network and Internet => Network Connections, we have the following situation (sorted by Device Name):
    Name
    (in Zabbix: #IFALIAS)
    Device Name
    (in Zabbix: almost #IFNAME)
    Status
    Repl 10.x.x.33 Fujitsu DynamicLoM Emulex OCl1400-LOM Enabled
    NAS 10.x.x.17 Fujitsu DynamicLoM Emulex OCl1400-LOM #2 Enabled
    vEthernet (MGW01) Hyper-V Virtual Ethernet Adapter Unidentified network
    vEthernet (MGW02) Hyper-V Virtual Ethernet Adapter #2 Unidentified network
    vEthernet (MGW03) Hyper-V Virtual Ethernet Adapter #3 Unidentified network
    vEthernet (NAS) Hyper-V Virtual Ethernet Adapter #4 Unidentified network
    vEthernet (Repl) Hyper-V Virtual Ethernet Adapter #5 Unidentified network
    MGW02 (10.x.x.67) Intel(R) Ethernet Server Adapter I350-T4 Enabled
    MGW01 (10.x.x.49) Intel(R) Ethernet Server Adapter I350-T4 #2 Enabled
    MGW03 (10.x.x.83) Intel(R) Ethernet Server Adapter I350-T4 #3 Enabled
    USV (10.y.z.10) Intel(R) Ethernet Server Adapter I350-T4 #4 Enabled
    Please note that for *some* reason, the subnet mask is /28 - so these interfaces are all in different subnets, with the exception of the last interface "USV (10.y.z.10).

    This can be confirmed with PowerShell => Get-NetAdapter (altough the number of characters is too long, so there are a few ... in between).


    What it does right:
    - History of Zabbix raw items => "Network interfaces WMI get" displays the raw data containing all the expected info like Name, Alias, Status, etc.
    - for each item, 3 interface-items will be created (expected would be 6 interface-items)

    BUT...
    The "Name" (which will be translated into Zabbix #IFNAME, I assume) in this "Network interfaces WMI get" is not unique:
    Intel(R) Ethernet Server Adapter I350-T4 => 3 times
    Intel(R) Ethernet Server Adapter I350-T4 #4 => 1 time
    Fujitsu DynamicLoM Emulex OCl1400-LOM => 2 times


    What it does not:
    - discovers only three interfaces instead of six, for the rest:
    Discovery Rules (4) => Network interfaces WMI get: Network interfaces discovery => Info: "Cannot create item: item with same key "net.if.in["Intel(R) Ethernet Server Adapter I350-T4",dropped]" already exists

    - mixes up the correspondance of #IFAlias and status information (I assume the status info matches the #IFNAME, but not 100% certain).


    What have I tried so far:
    As a clueless novice, I fiddled around with the template and created additional discovery rule => item prototypes. these revealed some (to me) interesting information:
    Name Key Item: Status
    Interface {#IFALIAS}: Bits received net.if.in["{#IFNAME}"] 3 items: "Enabled"
    Interface {#IFALIAS}: Bits received net.if.in["{#IFALIAS}"] 6 items: "Not supported" / Canot obtain network interface information
    Interface {#IFALIAS}: Bits received net.if.in2["{#IFNAME}"] 3 items: "Not supported" / Unsupported item key
    Interface {#IFALIAS}: Bits received net.if.in2["{#IFALIAS}"] 6 items: "Not supported" / Unsupported item key
    I know that the default name would contain #IFNAME instead of #IFALIAS, but basically the same behaviour already existed before.

    For some reason, in my current setting it seems to be discovering more interfaces (items) when using #IFALIAS (because this is unique) compared to using #IFNAME (which is not unique from Zabbix' point of view).
    Unfortunately, Zabbix is not able to resolve the information based on #IFALIAS to further successfully create the items.


    Going further:
    My feeling is that it might be related to the # in the interface name. But I have no clue how to futher debug...
    => Is it a Zabbix issue?
    => Do I have to resolve it in Windows Server? (How exactly?)
    => Is there a transaltion issue since Zabbix is running on Ubuntu, but WMI-requesting the interface names? (How would I find out?)

    And most importantly:
    => How am I going further into debugging this?
    => Can I provide any additional information? How exactly?
  • c1support
    Member
    • Apr 2020
    • 47

    #2
    Just wanted to add the same info as above, but in the form of screenshots:

    Windows Server 2016: Network Connections (containing #IFNAME and #IFALIAS)
    Click image for larger version  Name:	image_15851.png Views:	6 Size:	46.5 KB ID:	399048


    Zabbix: Discovery
    Click image for larger version  Name:	zabbix_ItemPrototype_bitsReceived_IFALIAS.PNG Views:	0 Size:	33.8 KB ID:	399049
    --> this discovery rule was manually added to the template by me for debugging purposes only (see previous post)


    Click image for larger version  Name:	zabbix_ItemPrototype_bitsReceived_IFNAME.PNG Views:	0 Size:	33.9 KB ID:	399051


    Click image for larger version  Name:	zabbixHost_Items_bitsReceived.PNG Views:	0 Size:	124.7 KB ID:	399050
    --> Info for first six lines: "Cannot obtain network interface information."
    --> this is (sort of) expected and only shown for debugging purposes (see previous post)


    Zabbix: Latest data: Network Interfaces

    --> showing wrong mapping (all three interfaces with #IFALIAS under "Name" should be "Connected (2)" under "Last value")
    --> however, #IFALIAS "MGW02" and "Repl" should be "Disconnected (7)"


    PS: During debugging, I found out that in /etc/zabbix/zabbix_agent.conf, a wrong value for Hostname was set. This resulted in warnings in /var/log/zabbix/zabbix_agentd.log like "... host [Zabbix server] not found". Since the system does not use active checks, I did not pay more attention to this before. And I suspect that correcting this will not resolve above situation (so far it has not yet, but I learned that sometimes Zabbix takes its time - so no preliminary conclusions here).
    Attached Files
    Last edited by c1support; 09-04-2020, 22:46.

    Comment

    • c1support
      Member
      • Apr 2020
      • 47

      #3
      And there is an example of "Network Interfaces WMI get":
      Code:
      2020-04-09 19:00:05
      [
      {"AdapterType":"Ethernet 802.3","AdapterTypeId":0,"Availability":3,"Caption":"[00000001] Intel(R) Ethernet Server Adapter I350-T4","ConfigManagerErrorCode":0,"ConfigManagerUserConfig":"False","CreationClassName":"Win32_NetworkAdapter","Description":"Intel(R) Ethernet Server Adapter I350-T4","DeviceID":"1","GUID":"{FC4A11C8-4B80-4628-B284-F01F16F1BC05}","Index":1,"Installed":"True","InterfaceIndex":36,"MACAddress":"XX:XX:XX:XX:XX:XX","Manufacturer":"Intel Corporation","MaxNumberControlled":0,"Name":"Intel(R) Ethernet Server Adapter I350-T4","NetConnectionID":"MGW02 10.xx.xx.67","NetConnectionStatus":7,"NetEnabled":"False","PhysicalAdapter":"True","PNPDeviceID":"PCI\\\\VEN_8086&DEV_1521&SUBSYS_00A18086&REV_01\\\\B49691FFFF03472401","PowerManagementSupported":"False","ProductName":"Intel(R) Ethernet Server Adapter I350-T4","ServiceName":"e1iexpress","SystemCreationClassName":"Win32_ComputerSystem","SystemName":"XYZXYZ","TimeOfLastReset":"20200310131634.486880+060"},
      {"AdapterType":"Ethernet 802.3","AdapterTypeId":0,"Availability":3,"Caption":"[00000002] Intel(R) Ethernet Server Adapter I350-T4","ConfigManagerErrorCode":0,"ConfigManagerUserConfig":"False","CreationClassName":"Win32_NetworkAdapter","Description":"Intel(R) Ethernet Server Adapter I350-T4","DeviceID":"2","GUID":"{61911650-C4E4-48E6-8AF0-1E1E8A2A8317}","Index":2,"Installed":"True","InterfaceIndex":15,"MACAddress":"XX:XX:XX:XX:XX:XX","Manufacturer":"Intel Corporation","MaxNumberControlled":0,"Name":"Intel(R) Ethernet Server Adapter I350-T4","NetConnectionID":"MGW01 10.xx.xx.49","NetConnectionStatus":2,"NetEnabled":"True","PhysicalAdapter":"True","PNPDeviceID":"PCI\\\\VEN_8086&DEV_1521&SUBSYS_00A18086&REV_01\\\\B49691FFFF03472400","PowerManagementSupported":"False","ProductName":"Intel(R) Ethernet Server Adapter I350-T4","ServiceName":"e1iexpress","SystemCreationClassName":"Win32_ComputerSystem","SystemName":"XYZXYZ","TimeOfLastReset":"20200310131634.486880+060"},
      {"AdapterType":"Ethernet 802.3","AdapterTypeId":0,"Availability":3,"Caption":"[00000003] Intel(R) Ethernet Server Adapter I350-T4","ConfigManagerErrorCode":0,"ConfigManagerUserConfig":"False","CreationClassName":"Win32_NetworkAdapter","Description":"Intel(R) Ethernet Server Adapter I350-T4","DeviceID":"3","GUID":"{73A79C02-B35E-41DF-BF1F-1C0BE849DA60}","Index":3,"Installed":"True","InterfaceIndex":22,"MACAddress":"XX:XX:XX:XX:XX:XX","Manufacturer":"Intel Corporation","MaxNumberControlled":0,"Name":"Intel(R) Ethernet Server Adapter I350-T4","NetConnectionID":"MGW03 10.xx.xx.83","NetConnectionStatus":2,"NetEnabled":"True","PhysicalAdapter":"True","PNPDeviceID":"PCI\\\\VEN_8086&DEV_1521&SUBSYS_00A18086&REV_01\\\\B49691FFFF03472402","PowerManagementSupported":"False","ProductName":"Intel(R) Ethernet Server Adapter I350-T4","ServiceName":"e1iexpress","SystemCreationClassName":"Win32_ComputerSystem","SystemName":"XYZXYZ","TimeOfLastReset":"20200310131634.486880+060"},
      {"AdapterType":"Ethernet 802.3","AdapterTypeId":0,"Availability":3,"Caption":"[00000004] Fujitsu DynamicLoM Emulex OCl14000-LOM","ConfigManagerErrorCode":0,"ConfigManagerUserConfig":"False","CreationClassName":"Win32_NetworkAdapter","Description":"Fujitsu DynamicLoM Emulex OCl14000-LOM","DeviceID":"4","GUID":"{7DDF7DA9-787D-4E5D-AF36-F7E43B5F33DB}","Index":4,"Installed":"True","InterfaceIndex":25,"MACAddress":"XX:XX:XX:XX:XX:XX","Manufacturer":"Emulex","MaxNumberControlled":0,"Name":"Fujitsu DynamicLoM Emulex OCl14000-LOM","NetConnectionID":"Repl 10.xx.xx.33","NetConnectionStatus":7,"NetEnabled":"False","PhysicalAdapter":"True","PNPDeviceID":"PCI\\\\VEN_10DF&DEV_0720&SUBSYS_120E1734&REV_11\\\\901B0EFFFED1366001","PowerManagementSupported":"False","ProductName":"Fujitsu DynamicLoM Emulex OCl14000-LOM","ServiceName":"be2net","SystemCreationClassName":"Win32_ComputerSystem","SystemName":"XYZXYZ","TimeOfLastReset":"20200310131634.486880+060"},
      {"AdapterType":"Ethernet 802.3","AdapterTypeId":0,"Availability":3,"Caption":"[00000005] Fujitsu DynamicLoM Emulex OCl14000-LOM","ConfigManagerErrorCode":0,"ConfigManagerUserConfig":"False","CreationClassName":"Win32_NetworkAdapter","Description":"Fujitsu DynamicLoM Emulex OCl14000-LOM","DeviceID":"5","GUID":"{0DC0DB1B-CF7A-460A-84FE-87A54612B2C2}","Index":5,"Installed":"True","InterfaceIndex":2,"MACAddress":"XX:XX:XX:XX:XX:XX","Manufacturer":"Emulex","MaxNumberControlled":0,"Name":"Fujitsu DynamicLoM Emulex OCl14000-LOM","NetConnectionID":"NAS 10.xx.xx.17","NetConnectionStatus":2,"NetEnabled":"True","PhysicalAdapter":"True","PNPDeviceID":"PCI\\\\VEN_10DF&DEV_0720&SUBSYS_120E1734&REV_11\\\\901B0EFFFED1366000","PowerManagementSupported":"False","ProductName":"Fujitsu DynamicLoM Emulex OCl14000-LOM","ServiceName":"be2net","SystemCreationClassName":"Win32_ComputerSystem","SystemName":"XYZXYZ","TimeOfLastReset":"20200310131634.486880+060"},
      {"AdapterType":"Ethernet 802.3","AdapterTypeId":0,"Availability":3,"Caption":"[00000006] Intel(R) Ethernet Server Adapter I350-T4","ConfigManagerErrorCode":0,"ConfigManagerUserConfig":"False","CreationClassName":"Win32_NetworkAdapter","Description":"Intel(R) Ethernet Server Adapter I350-T4","DeviceID":"6","GUID":"{9C9194FF-4597-4EA5-A84B-E831C19DAEB2}","Index":6,"Installed":"True","InterfaceIndex":28,"MACAddress":"XX:XX:XX:XX:XX:XX","Manufacturer":"Intel Corporation","MaxNumberControlled":0,"Name":"Intel(R) Ethernet Server Adapter I350-T4 #4","NetConnectionID":"USV 10.yy.zz.10","NetConnectionStatus":2,"NetEnabled":"True","PhysicalAdapter":"True","PNPDeviceID":"PCI\\\\VEN_8086&DEV_1521&SUBSYS_00A18086&REV_01\\\\B49691FFFF03472403","PowerManagementSupported":"False","ProductName":"Intel(R) Ethernet Server Adapter I350-T4","ServiceName":"e1iexpress","Speed":"1000000000","SystemCreationClassName":"Win32_ComputerSystem","SystemName":"XYZXYZ","TimeOfLastReset":"20200310131634.486880+060"},
      {"AdapterType":"Ethernet 802.3","AdapterTypeId":0,"Availability":3,"Caption":"[00000012] Hyper-V Virtual Ethernet Adapter","ConfigManagerErrorCode":0,"ConfigManagerUserConfig":"False","CreationClassName":"Win32_NetworkAdapter","Description":"Hyper-V Virtual Ethernet Adapter","DeviceID":"12","GUID":"{444A2561-72FD-4E10-95C6-8BC8E098FB43}","Index":12,"Installed":"True","InterfaceIndex":11,"MACAddress":"XX:XX:XX:XX:XX:XX","Manufacturer":"Microsoft","MaxNumberControlled":0,"Name":"Hyper-V Virtual Ethernet Adapter","NetConnectionID":"vEthernet (MGW01 10.xx.xx.49-62)","NetConnectionStatus":2,"NetEnabled":"True","PhysicalAdapter":"True","PNPDeviceID":"ROOT\\\\VMS_MP\\\\0000","PowerManagementSupported":"False","ProductName":"Hyper-V Virtual Ethernet Adapter","ServiceName":"VMSMP","Speed":"1000000000","SystemCreationClassName":"Win32_ComputerSystem","SystemName":"XYZXYZ","TimeOfLastReset":"20200310131634.486880+060"},
      {"AdapterType":"Ethernet 802.3","AdapterTypeId":0,"Availability":3,"Caption":"[00000016] Hyper-V Virtual Ethernet Adapter","ConfigManagerErrorCode":0,"ConfigManagerUserConfig":"False","CreationClassName":"Win32_NetworkAdapter","Description":"Hyper-V Virtual Ethernet Adapter","DeviceID":"16","GUID":"{B8511B01-C2E3-49E3-96D7-12FE409C776E}","Index":16,"Installed":"True","InterfaceIndex":33,"MACAddress":"XX:XX:XX:XX:XX:XX","Manufacturer":"Microsoft","MaxNumberControlled":0,"Name":"Hyper-V Virtual Ethernet Adapter #2","NetConnectionID":"vEthernet (MGW02 10.xx.xx.65-78)","NetConnectionStatus":2,"NetEnabled":"True","PhysicalAdapter":"True","PNPDeviceID":"ROOT\\\\VMS_MP\\\\0001","PowerManagementSupported":"False","ProductName":"Hyper-V Virtual Ethernet Adapter","ServiceName":"VMSMP","Speed":"1000000000","SystemCreationClassName":"Win32_ComputerSystem","SystemName":"XYZXYZ","TimeOfLastReset":"20200310131634.486880+060"},
      {"AdapterType":"Ethernet 802.3","AdapterTypeId":0,"Availability":3,"Caption":"[00000018] Hyper-V Virtual Ethernet Adapter","ConfigManagerErrorCode":0,"ConfigManagerUserConfig":"False","CreationClassName":"Win32_NetworkAdapter","Description":"Hyper-V Virtual Ethernet Adapter","DeviceID":"18","GUID":"{C6E9404F-1F87-4C3E-9791-64A5A2E0D8E7}","Index":18,"Installed":"True","InterfaceIndex":34,"MACAddress":"XX:XX:XX:XX:XX:XX","Manufacturer":"Microsoft","MaxNumberControlled":0,"Name":"Hyper-V Virtual Ethernet Adapter #3","NetConnectionID":"vEthernet (MGW03 10.xx.xx.81-94)","NetConnectionStatus":2,"NetEnabled":"True","PhysicalAdapter":"True","PNPDeviceID":"ROOT\\\\VMS_MP\\\\0002","PowerManagementSupported":"False","ProductName":"Hyper-V Virtual Ethernet Adapter","ServiceName":"VMSMP","Speed":"1000000000","SystemCreationClassName":"Win32_ComputerSystem","SystemName":"XYZXYZ","TimeOfLastReset":"20200310131634.486880+060"},
      {"AdapterType":"Ethernet 802.3","AdapterTypeId":0,"Availability":3,"Caption":"[00000030] Hyper-V Virtual Ethernet Adapter","ConfigManagerErrorCode":0,"ConfigManagerUserConfig":"False","CreationClassName":"Win32_NetworkAdapter","Description":"Hyper-V Virtual Ethernet Adapter","DeviceID":"30","GUID":"{1222734C-1BA1-420F-A0E1-0CB709D54E00}","Index":30,"Installed":"True","InterfaceIndex":3,"MACAddress":"XX:XX:XX:XX:XX:XX","Manufacturer":"Microsoft","MaxNumberControlled":0,"Name":"Hyper-V Virtual Ethernet Adapter #4","NetConnectionID":"vEthernet (NAS 10.xx.xx.17-30)","NetConnectionStatus":2,"NetEnabled":"True","PhysicalAdapter":"True","PNPDeviceID":"ROOT\\\\VMS_MP\\\\0003","PowerManagementSupported":"False","ProductName":"Hyper-V Virtual Ethernet Adapter","ServiceName":"VMSMP","Speed":"1000000000","SystemCreationClassName":"Win32_ComputerSystem","SystemName":"XYZXYZ","TimeOfLastReset":"20200310131634.486880+060"},
      {"AdapterType":"Ethernet 802.3","AdapterTypeId":0,"Availability":3,"Caption":"[00000033] Hyper-V Virtual Ethernet Adapter","ConfigManagerErrorCode":0,"ConfigManagerUserConfig":"False","CreationClassName":"Win32_NetworkAdapter","Description":"Hyper-V Virtual Ethernet Adapter","DeviceID":"33","GUID":"{72213251-487E-42C3-9C71-772AFFF43753}","Index":33,"Installed":"True","InterfaceIndex":21,"MACAddress":"XX:XX:XX:XX:XX:XX","Manufacturer":"Microsoft","MaxNumberControlled":0,"Name":"Hyper-V Virtual Ethernet Adapter #5","NetConnectionID":"vEthernet (Repl 10.xx.xx.33-46)","NetConnectionStatus":2,"NetEnabled":"True","PhysicalAdapter":"True","PNPDeviceID":"ROOT\\\\VMS_MP\\\\0004","PowerManagementSupported":"False","ProductName":"Hyper-V Virtual Ethernet Adapter","ServiceName":"VMSMP","Speed":"1000000000","SystemCreationClassName":"Win32_ComputerSystem","SystemName":"XYZXYZ","TimeOfLastReset":"20200310131634.486880+060"}
      ]
      To my understanding, correct WOULD be something like this (only difference is between "Name" and "NetConnectionID"):
      --> line 4: "Name":"Intel(R) Ethernet Server Adapter I350-T4 #2","NetConnectionID":"MGW01 10.x.x.49":
      Code:
      {"AdapterType":"Ethernet 802.3","AdapterTypeId":0,"Availability":3,"Caption":"[00000002] Intel(R) Ethernet Server Adapter I350-T4","ConfigManagerErrorCode":0,"ConfigManagerUserConfig":"False","CreationClassName":"Win32_NetworkAdapter","Description":"Intel(R) Ethernet Server Adapter I350-T4","DeviceID":"2","GUID":"{61911650-C4E4-48E6-8AF0-1E1E8A2A8317}","Index":2,"Installed":"True","InterfaceIndex":15,"MACAddress":"XX:XX:XX:XX:XX:XX","Manufacturer":"Intel Corporation","MaxNumberControlled":0,"Name":"Intel(R) Ethernet Server Adapter I350-T4 #2","NetConnectionID":"MGW01 10.xx.xx.49","NetConnectionStatus":2,"NetEnabled":"True","PhysicalAdapter":"True","PNPDeviceID":"PCI\\\\VEN_8086&DEV_1521&SUBSYS_00A18086&REV_01\\\\B49691FFFF03472400","PowerManagementSupported":"False","ProductName":"Intel(R) Ethernet Server Adapter I350-T4","ServiceName":"e1iexpress","SystemCreationClassName":"Win32_ComputerSystem","SystemName":"XYZXYZ","TimeOfLastReset":"20200310131634.486880+060"},
      --> line 5: "Name":"Intel(R) Ethernet Server Adapter I350-T4 #3","NetConnectionID":"MGW03 10.x.x.83":
      Code:
      {"AdapterType":"Ethernet 802.3","AdapterTypeId":0,"Availability":3,"Caption":"[00000003] Intel(R) Ethernet Server Adapter I350-T4","ConfigManagerErrorCode":0,"ConfigManagerUserConfig":"False","CreationClassName":"Win32_NetworkAdapter","Description":"Intel(R) Ethernet Server Adapter I350-T4","DeviceID":"3","GUID":"{73A79C02-B35E-41DF-BF1F-1C0BE849DA60}","Index":3,"Installed":"True","InterfaceIndex":22,"MACAddress":"XX:XX:XX:XX:XX:XX","Manufacturer":"Intel Corporation","MaxNumberControlled":0,"Name":"Intel(R) Ethernet Server Adapter I350-T4 #3","NetConnectionID":"MGW03 10.xx.xx.83","NetConnectionStatus":2,"NetEnabled":"True","PhysicalAdapter":"True","PNPDeviceID":"PCI\\\\VEN_8086&DEV_1521&SUBSYS_00A18086&REV_01\\\\B49691FFFF03472402","PowerManagementSupported":"False","ProductName":"Intel(R) Ethernet Server Adapter I350-T4","ServiceName":"e1iexpress","SystemCreationClassName":"Win32_ComputerSystem","SystemName":"XYZXYZ","TimeOfLastReset":"20200310131634.486880+060"},
      --> line 7: "Name":"Fujitsu DynamicLoM Emulex OCl14000-LOM #2","NetConnectionID":"NAS 10.x.x.17":
      Code:
      {"AdapterType":"Ethernet 802.3","AdapterTypeId":0,"Availability":3,"Caption":"[00000005] Fujitsu DynamicLoM Emulex OCl14000-LOM","ConfigManagerErrorCode":0,"ConfigManagerUserConfig":"False","CreationClassName":"Win32_NetworkAdapter","Description":"Fujitsu DynamicLoM Emulex OCl14000-LOM","DeviceID":"5","GUID":"{0DC0DB1B-CF7A-460A-84FE-87A54612B2C2}","Index":5,"Installed":"True","InterfaceIndex":2,"MACAddress":"XX:XX:XX:XX:XX:XX","Manufacturer":"Emulex","MaxNumberControlled":0,"Name":"Fujitsu DynamicLoM Emulex OCl14000-LOM #2","NetConnectionID":"NAS 10.xx.xx.17","NetConnectionStatus":2,"NetEnabled":"True","PhysicalAdapter":"True","PNPDeviceID":"PCI\\\\VEN_10DF&DEV_0720&SUBSYS_120E1734&REV_11\\\\901B0EFFFED1366000","PowerManagementSupported":"False","ProductName":"Fujitsu DynamicLoM Emulex OCl14000-LOM","ServiceName":"be2net","SystemCreationClassName":"Win32_ComputerSystem","SystemName":"XYZXYZ","TimeOfLastReset":"20200310131634.486880+060"},

      --> Can anybody tell me how this information is gathered?
      --> What could go wrong (i.e. why are the last few characters ommited, including the Whitespace " " - bedause if this was not the case, Zabbix would only be missing one interface instead of three)?
      --> Is there an alternative way to request this WMI-information manually (for debugging purposes)? (Like from Windows Server or from Ubuntu CLI)?
      Last edited by c1support; 09-04-2020, 23:10.

      Comment

      • c1support
        Member
        • Apr 2020
        • 47

        #4
        Just tried the following PowerShell command on the Windows Server 2016 in question:
        Code:
        (Get-WmiObject Win32_networkadapter)
        I think that this demonstrates that Windows already returns the worng "Name" for the interfaces.

        => If this conclusion is correct, what would be the best way to proceed?
        (I am no Windows expert, and I have no idea which channels are best suited for placing such a support request / bug report)
        Last edited by c1support; 09-04-2020, 23:28.

        Comment

        • tim.mooney
          Senior Member
          • Dec 2012
          • 1427

          #5
          I think it would be very useful to see the exact results that 'net.if.discovery' is returning and to know if discovery is triggering any issues on that client.

          Here's what I would try:

          On the Windows client with interfaces that are not being correctly discovered:
          1. Stop the running zabbix_agent service.
          2. Modify the zabbix_agentd.conf, find the "DebugLevel=" entry (may be commented out with #) and temporarily uncomment it and set it to "DebugLevel=5".
            • Note: you can dynamically increase and decrease the log level of the zabbix agent using command line flags, but I only know the exact syntax to do that on Linux, and since I'm recommending you stop the agent anyway (for the next step), manually setting the DebugLevel is the most straightforward method to do this.
          3. remove or truncate the existing zabbix_agentd.log (or whatever you've called it). This is to make sure that what you see in the log is recent and relevant to these steps.
          4. restart the zabbix_agentd

          Then, on your Ubuntu Zabbix server:
          1. Assuming you have "sudo" permission on the Zabbix server, to be able to run individual commands as the root or another user, run the following command:
            Code:
            sudo -u zabbix zabbix_get -s your_windows_client_zabbix_name_here -p 10050 -k 'net.if.discovery'
            • The "sudo -u zabbix" runs the following command ("zabbix_get -s your_windows_client_zabbix_name_here -p 10050 -k 'net.if.discovery'") as the zabbix user, which I'm assuming is the user most Zabbix-related processes are running as.
            • Note also that the argument to the "-s" is the system name you gave the Windows client when you created it in Zabbix
          2. You should get back the exact JSON array that net.if.discovery returns. Save that output.
          Run the JSON through a JSON pretty printer (you can find many online if you don't have a command on Ubuntu to do it, https://jsonformatter.org/json-pretty-print from a quick Google search seems to work OK for this) and post it and the logs from the zabbix_agentd on the Windows client here.

          PS: Remember to reset the DebugLevel in your zabbix_agentd.conf and restart the service.

          Comment

          • c1support
            Member
            • Apr 2020
            • 47

            #6
            Dear Tim
            Thank you very much for the helpful instructions!
            I was able to perform all the steps (except that I had to use Windows Servers' IP address instead of the hostname - did not seem important enough to fix this at the time).
            I currently have only limited access to the system, so I can only post the essence but no screenshots.

            My findings:
            1. Zabbix agent version
            Windows Server is Zabbix Agent v4.4.5 (whereas Zabbix Server v4.4.7, according to the Web Interface)
            Code:
            sudo -u zabbix zabbix_get -s 10.x.x.49 -p 10050 -k 'agent.version'
            4.4.5
            2. net.if.discovery (on Zabbix Server):
            Code:
            sudo -u zabbix zabbix_get -s 10.x.x.49 -p 10050 -k 'net.if.discovery'
            ...
            {"{#IFNAME}":"Intel(R) Ethernet Server Adapter I350-T4"},
            {"{#IFNAME}":"Intel(R) Ethernet Server Adapter I350-T4 #2"},
            {"{#IFNAME}":"Intel(R) Ethernet Server Adapter I350-T4 #3"},
            {"{#IFNAME}":"Fujitsu DynamicLoM Emulex OCl1400-LOM"},
            {"{#IFNAME}":"Fujitsu DynamicLoM Emulex OCl1400-LOM #2"},
            {"{#IFNAME}":"Intel(R) Ethernet Server Adapter I350-T4 #4"},
            ... ]
            3. Logfile contents of Zabbix Agent
            The above result matches the entries in the log file on Windows Server.

            4. net.if.list:
            Code:
            sudo -u zabbix zabbix_get -s 10.x.x.49 -p 10050 -k 'net.if.list'
            ...
            - Intel(R) Ethernet Server Adapter I350-T4 #2-WFP Native MAC Layer LightWeight Filter-0000
            - Intel(R) Ethernet Server Adapter I350-T4-WFP Native MAC Layer LightWeight Filter-0000
            - Intel(R) Ethernet Server Adapter I350-T4 #3-WFP Native MAC Layer LightWeight Filter-0000
            - Intel(R) Ethernet Server Adapter I350-T4 #4-WFP Native MAC Layer LightWeight Filter-0000
            - Intel(R) Ethernet Server Adapter I350-T4 #4-QoS Packet Scheduler-0000
            - Intel(R) Ethernet Server Adapter I350-T4 #4-WFP 802.3 MAC Layer LightWeight Filter-0000
            - Intel(R) Ethernet Server Adapter I350-T4 #
            - Intel(R) Ethernet Server Adapter I350-T4 #2
            - Intel(R) Ethernet Server Adapter I350-T4 #3
            10.y.z.10 Intel(R) Ethernet Server Adapter I350-T4 #4
            ...
            - Fujitsu DynamicLoM Emulex OCl14000-LOM #2-WFP Native MAC Layer LightWeight Filter-0000
            - Fujitsu DynamicLoM Emulex OCl14000-LOM-WFP Native MAC Layer LightWeight Filter-0000
            - Fujitsu DynamicLoM Emulex OCl14000-LOM
            - Fujitsu DynamicLoM Emulex OCl14000-LOM #2
            ...
            (actual order of first and second block might be different: used grep Server and grep LOM to extract above blocks)
            => Intel(R) Ethernet Server Adapter I350-T4 #4 seems to be treated very differently from the others. This is the only interface which is not connected to Hyper-V Virtual Switch.

            5. net.if.in (manually inserted #IFNAME):
            Code:
            sudo -u zabbix zabbix_get -s 10.x.x.49 -p 10050 -k 'net.if.in["Intel(R) Ethernet Server Adapter I350-T4"]'
            0
            sudo -u zabbix zabbix_get -s 10.x.x.49 -p 10050 -k 'net.if.in["Intel(R) Ethernet Server Adapter I350-T4 #2"]'
            95'5xx'xxx
            sudo -u zabbix zabbix_get -s 10.x.x.49 -p 10050 -k 'net.if.in["Intel(R) Ethernet Server Adapter I350-T4 #3"]'
            187'xxx'xxx
            sudo -u zabbix zabbix_get -s 10.x.x.49 -p 10050 -k 'net.if.in["Intel(R) Ethernet Server Adapter I350-T4 #4"]'
            2'15x'xxx
            sudo -u zabbix zabbix_get -s 10.x.x.49 -p 10050 -k 'net.if.in["Fujitsu DynamicLoM Emulex OCl14000-LOM"]'
            ZBX_NOTSUPPORTED: Cannot obtain network interface information.
            sudo -u zabbix zabbix_get -s 10.x.x.49 -p 10050 -k 'net.if.in["Fujitsu DynamicLoM Emulex OCl14000-LOM #2"]'
            ZBX_NOTSUPPORTED: Cannot obtain network interface information.
            (might be a typo in lines 5 and 6 - might try again later)
            => the relative distribution seems plausible for lins 1 to 4 (even though 0 is a small number for an interface with a device connected to)

            6. net.if.status (manually inserted #IFNAME):
            Code:
            sudo -u zabbix zabbix_get -s 10.x.x.49 -p 10050 -k 'net.if.status["Intel(R) Ethernet Server Adapter I350-T4 #4"]'
            ZBX_NOTSUPPORTED: Unsupported item key.
            (this is probably because net.if.status is a "dependent item")

            7. findings from further googling
            Furthermore, I stumbled across the following:

            At a first glance it seems to me that Benjamin RIOUALs post from 2018-03-06 might have a solution to my issue.
            => I will verify this asap.
            Last edited by c1support; 11-04-2020, 11:43.

            Comment

            • tim.mooney
              Senior Member
              • Dec 2012
              • 1427

              #7
              No screenshots needed for this, the output you've provided has all the relevant info I was wondering about, especially the results from 'net.if.discovery'. It seems like the discovery is returning the correct names (with the #2, #3, etc. where appropriate).

              There weren't any "failed with error" messages in the zabbix_agentd.log? The presence of those would indicate that NET_IF_DISCOVERY() encountered a problem while calling GetIfTable.

              The ZBXNEXT issue you found does indeed seem very close to yours, if nothing else you should vote for it and comment on it linking to this forum thread.

              Comment

              • c1support
                Member
                • Apr 2020
                • 47

                #8
                Thank you very much for your fast replies, this is highly appreciated!
                We seem to be getting closer :-)

                1. Verify "Get-WmiObject MSFT_NetAdapter -Namespace root\standardcimv2"
                When executed in Powershell, as proposed by Benjamin https://support.zabbix.com/browse/ZBXNEXT-2765 the pair Name / InterfaceDescription returns unique values:
                Name InterfaceDescription
                Repl 10.x.x.33 Fujitsu DynamicLoM Emulex OCl1400-LOM
                NAS 10.x.x.17 Fujitsu DynamicLoM Emulex OCl1400-LOM #2
                vEthernet (MGW01) Hyper-V Virtual Ethernet Adapter
                vEthernet (MGW02) Hyper-V Virtual Ethernet Adapter #2
                vEthernet (MGW03) Hyper-V Virtual Ethernet Adapter #3
                vEthernet (NAS) Hyper-V Virtual Ethernet Adapter #4
                vEthernet (Repl) Hyper-V Virtual Ethernet Adapter #5
                MGW02 (10.x.x.67) Intel(R) Ethernet Server Adapter I350-T4
                MGW01 (10.x.x.49) Intel(R) Ethernet Server Adapter I350-T4 #2
                MGW03 (10.x.x.83) Intel(R) Ethernet Server Adapter I350-T4 #3
                USV (10.y.z.10) Intel(R) Ethernet Server Adapter I350-T4 #4
                --> this seems very promising

                2. Created "net.if.discovery.ps1" on Windows Server
                As suggested by Benjamin, I created the following Powershell script:
                Code:
                $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
                (not sure if the last line does not cause any issues - seems to be left for debugging purposes)

                3. added UserParameter to zabbix_agent.conf
                On Windows Server, I modified zabbix_agent.conf:
                Code:
                UserParameter=[The first and totally unrelated UserParameter just remains here, hoping that it still works after the next line]
                UserParameter=windows.net.if.discovery,powershell.exe -executionpolicy bypass -file "C:\[LinkToScript]\net.if.discovery.ps1"
                In fact, I already used another UserParameter. Not sure yet if this will remain functioning. According to the description inside zabbix_agent.conf, "There can be several user-defined parameters". No hints regarding syntax; no luck with googling so far.
                --> I will have to keep this in mind

                4. added discovery rule and item prototype in Zabbix
                In "Template Module Windows network", I added a discovery rule "Network interfaces discovery NEW", Type "Zabbix agent", Key "windows.net.if.discovery".
                Added the following item prototypes:
                - Interface {#IFNAME}: Bits received NEW net.if.in[{#IFDESCRIPTION}]
                - Interface {#IFNAME}: Bits sent NEW net.if.out[{#IFDESCRIPTION}]
                - Interface {#IFNAME}: Operation status NEW net.if.status[{#IFDESCRIPTION}]

                5. Verify in logfile
                After "Check now", I verified in the zabbix_agent.log on Windows Server. Seems to return the value created above:
                Code:
                EXECUTE_STR() command: [...] net.if.discovery.ps1 [...]
                Sending back [{"data":[
                {"{#IFNAME}": [...]
                ,{"{#IFNAME}":"Repl 10.x.x.33","{#IFDESCRIPTION}":"Fujitsu DynamicLoM Emulex OCI14000-LOM"}
                ,{"{#IFNAME}":"NAS 10.x.x.17","{#IFDESCRIPTION}":"Fujitsu DynamicLoM Emulex OCI14000-LOM #2"}
                ,{"{#IFNAME}":"USV 10.x.x.10","{#IFDESCRIPTION}":"Intel(R) Ethernet Server Adapter I350-T4 #4"}
                ,{"{#IFNAME}":"MGW03 10.x.x.83","{#IFDESCRIPTION}":"Intel(R) Ethernet Server Adapter I350-T4 #3"}
                ,{"{#IFNAME}":"MGW02 10.x.x.67","{#IFDESCRIPTION}":"Intel(R) Ethernet Server Adapter I350-T4"}
                ,{"{#IFNAME}":"MGW01 10.x.x.49","{#IFDESCRIPTION}":"Intel(R) Ethernet Server Adapter I350-T4 #2"}
                ]}]
                (The original discovery rule "Network interfaces discovery" including item prototypes is still in place)

                6. verify in discovery rules
                After waiting a while, I checked the Zabbix GUI again. In the discovery rules under Info, there is a red exclamation mark saying:
                Code:
                Cannot update item: item with same key "net.if.in["Fujitsu DynamicLoM Emulex OCI14000-LOM"] already exists.
                Cannot update item: item with same key "net.if.in["Intel(R) Ethernet Server Adapter I350-T4 #4"] already exists.
                Cannot update item: item with same key "net.if.in["Intel(R) Ethernet Server Adapter I350-T4"] already exists.
                Cannot update item: item with same key "net.if.out["Fujitsu DynamicLoM Emulex OCI14000-LOM"] already exists.
                Cannot update item: item with same key "net.if.out["Intel(R) Ethernet Server Adapter I350-T4 #4"] already exists.
                Cannot update item: item with same key "net.if.out["Intel(R) Ethernet Server Adapter I350-T4"] already exists.
                Cannot update item: item with same key "net.if.status["Fujitsu DynamicLoM Emulex OCI14000-LOM"] already exists.
                Cannot update item: item with same key "net.if.status["Intel(R) Ethernet Server Adapter I350-T4 #4"] already exists.
                Cannot update item: item with same key "net.if.status["Intel(R) Ethernet Server Adapter I350-T4"] already exists.
                --> even though this is a warning, I believe this demonstrates that we are on the right path (remember: these three items were created by the default template, which will be disabled as soon as the rest works)

                7. Verify new items
                When checking the items, the following lines have been added for net.if.in and net.if.out:
                Code:
                Network Interfaces discovery New: Interface MGW03 10.x.x.83  net.if.in["Intel(R) Ethernet Server Adapter I350-T4 #3"]
                Network Interfaces discovery New: Interface MGW01 10.x.x.49  net.if.in["Intel(R) Ethernet Server Adapter I350-T4 #2"]
                Network Interfaces discovery New: Interface vEthernet Repl   net.if.in["Hyper-V Virtual Ethernet Adapter #5"]
                Network Interfaces discovery New: Interface vEthernet NAS    net.if.in["Hyper-V Virtual Ethernet Adapter #4"]
                Network Interfaces discovery New: Interface vEthernet MGW03  net.if.in["Hyper-V Virtual Ethernet Adapter #3"]
                Network Interfaces discovery New: Interface vEthernet MGW02  net.if.in["Hyper-V Virtual Ethernet Adapter #2"]
                Network Interfaces discovery New: Interface vEthernet MGW01  net.if.in["Hyper-V Virtual Ethernet Adapter"]
                Network Interfaces discovery New: Interface NAS 10.x.x.49    net.if.in["Fujitsu DynamicLoM Emulex OCI14000-LOM #2"]
                [... same for net.if.out ...]
                (with the original template, only physical interfaces are returned. I have to figure the best way to suppress the Hyper-V adapters - but one at a time)
                --> I will have to keep this in mind

                --> This seems to be almost what we wanted, expect for the dependent items:


                For net.if.status, the Info comes with a red exclamation mark:
                Code:
                Network Interfaces discovery New: Interface MGW03 10.x.x.83  net.if.status["Intel(R) Ethernet Server Adapter I350-T4 #3"]
                [... etc. for all interfaces mentioned above]
                [B][COLOR=#FF0000]Unsupported item key.[/COLOR][/B]

                8. Next steps
                Resolving this "dependent items" issue, I see two possibilities:
                a) add key/value-pair in net.if.discovery.ps1 (e.g. "{#IFOPERATINGSTATUS}":"$Adapter.OperationalStatus DownMediaDisconnected")
                usage in Zabbix item via assigning (inserting) the macro {#IFOPERATINGSTATUS} directly to the items' key field.
                --> Drawback of this might be that only discovered / called every XX minutes while dependent items can be requested every 1m

                b) making a dependent item out of it (even tough Benjamin used a Zabbix Agent type), but depending on a different WMI call (i.e. Get-WmiObject -Namespace root\standardcimv2)?

                --> would you agree? or is there a more elegant way?

                In either way, I would have to figure out the details of MSFT_NetAdapter, because both, OperatingStatus and OperationalStatus seem to be empty in my case.
                Last edited by c1support; 12-04-2020, 03:19.

                Comment

                • tim.mooney
                  Senior Member
                  • Dec 2012
                  • 1427

                  #9
                  Originally posted by c1support
                  3. added UserParameter to zabbix_agent.conf
                  On Windows Server, I modified zabbix_agent.conf:
                  Code:
                  UserParameter=[The first and totally unrelated UserParameter just remains here, hoping that it still works after the next line]
                  UserParameter=windows.net.if.discovery,powershell.exe -executionpolicy bypass -file "C:\[LinkToScript]\net.if.discovery.ps1"
                  In fact, I already used another UserParameter. Not sure yet if this will remain functioning. According to the description inside zabbix_agent.conf, "There can be several user-defined parameters". No hints regarding syntax; no luck with googling so far.
                  --> I will have to keep this in mind
                  I only have time to respond to this part of the post right now, I'll try respond to other parts when I have more time.

                  As far as UserParameter=, you can have many, many of them. It's the first argument, your custom item key (windows.net.if.discovery), that allows each UserParameter to be unique. Something like

                  Code:
                  UserParameter=custom.item.1,some_ps_code_here
                  UserParameter=custom.item.2,some_other_powershell_stuff_here
                  UserParameter=another.custom.item,more_powershell
                  is fine. It's the item key that makes it unique. I'm not certain if you have duplicate item keys if it's the first one or the last one that wins, but you could easily test that.

                  After using Zabbix for several years, my site has adopted a couple practices for custom items that may be helpful to you:
                  1. We used to just update zabbix_agentd.conf directly and add any custom item keys there, via one or more UserParameter lines. After using Zabbix for a few years, we've found it works better for us to not put any UserParameters directly in zabbix_agentd.conf. Instead, we try keep that file mostly the same, so we can use the same conf file on lots of different hosts. Instead, for UserParameters we put them in a custom config file in the zabbix_agentd.d directory.
                  2. We keep unrelated custom item keys in different files, so if we have two UserParameters related to Linux SAN volumes they might go in zabbix_agentd.d/linux-san-items.conf and custom UserParameters related to e.g. Oracle RDBMS might go in zabbix_agentd.d/oracle-db.conf. Just remember to restart the zabbix_agentd after putting any new config files in zabbix_agentd.d. Doing it this way, we only need to have the custom items defined that are appropriate for a particular host.
                  3. For custom item keys, we've adopted the convention (and that's all it is) of naming the item key with the abbreviation for the organization I work at. So if you work at e.g. NASA, you might use "nasa.net.if.discovery" for one item key and "nasa.some.other.key" for another item. By prefixing the custom item key with your workplace's name, it's very clear to everyone that looks at the item or trigger that this is a custom item in use at your site, rather than something built into Zabbix.

                  You can ignore all that or adopt any of it that makes sense for your site, but those practices are things we've adopted after years with the software.

                  Comment

                  • c1support
                    Member
                    • Apr 2020
                    • 47

                    #10
                    Thank you very much for the explanations regarding UserParameter. I will probably implement all three points, because I like modularity.

                    On the other issue, I am following path 8.b:

                    1. created new item "Network interfaces WMI get NEW"
                    Template Module Windows network by Zabbix agent: add item "Network interfaces WMI get NEW"
                    Key: wmi.getall[root\standardcimv2,"select * from MSFT_NetworkAdapter where HardwareInterface=True"]

                    After "Check now", under Monitoring => Latest data => Network interfaces WMI get NEW => History, the raw key-value-pairs for all six interfaces is displayed.
                    Code:
                    [
                    {"ActiveMaximumTransmissionUnit":"1500","AdminLocked":"False",...,"InterfaceDescription":"... #2",...},
                    {"ActiveMaximumTransmissionUnit":"1500","AdminLocked":"False",...,"InterfaceDescription":"... #3",...},
                    <etc. for all 6 HardwareInterfaces>
                    ]
                    => This seems to work properly.

                    2. Modified discovery rule to type "Dependent item"
                    Master item: Template Module Windows network by Zabbix agent: Network Interfaces WMI get NEW

                    After switching back to Host => Discovery rules => Network interfaces WMI get NEW => Check now, there is a warning:
                    Code:
                    [COLOR=#FF0000]Cannot create item: item with the same key "net.if.status["{#IFDESCRIPTION}"]" already exists. (5x)
                    Cannot create item: item with the same key "net.if.in["{#IFDESCRIPTION}"]" already exists.     (5x)
                    Cannot create item: item with the same key "net.if.out["{#IFDESCRIPTION}"]" already exists.    (5x)[/COLOR]
                    => This implies that the item with this key was once created.
                    However, no item is displayed.

                    When looking at the hosts' Applications, the previously created Applications now all have the info "The application is not discovered anymore and will be deleted in xx". Plus one new Application was created: "Interface {#IFNAME} ({#IFDESCRIPTION}).
                    => This implies that the Macro can not be resolved anymore.

                    zabbix_server.log (on Ubuntu) has no entries after "Check now"
                    zabbix_agentd.log (on Windows) says:
                    Code:
                    Requested [wmi.getall[root\standardcimv2,"select * from MSFT_NetworkAdapter where HardwareInterface=True"]]
                    Requested [service.info["NlaSvc",state]]
                    Sending back [0]
                    Sending back [[{"ActiveMaximumTransmissionUnit":"1500",...,"WdmInterface":"False"}]]
                    ​​​​​
                    3. Modified JavaScript Preprocessing of discovery rule "Network interfaces discovery NEW"
                    Code:
                    output = JSON.parse(value).map(function(net){
                      return {
                        "{#IFNAME}": net.Name,
                        "{#IFDESCRIPTION}": net.InterfaceDescription
                        "{#IFOPERATIONALSTATUS}": net.InterfaceOperationalStatus
                        "{#IFSPEED}": net.Speed
                      }
                    })
                    4. disabled discovery rule "Network interfaces discovery"
                    and manually deleted derived items (I believe this would have happened automatically, but I was not patient enough).

                    5. Created additional item prototypes for "Network interfaces discovery NEW"
                    Currently, the following item prototypes are present (Key / Name):
                    Code:
                    net.if.in["{#IFDESCRIPTION}"]             Interface {“IFNAME}: Bits received NEW
                    net.if.out["{#IFDESCRIPTION}"]            Interface {“IFNAME}: Bits sent NEW
                    net.if.in["{#IFDESCRIPTION}",errors]      Interface {“IFNAME}: Inbound packets with errors NEW
                    net.OperationalStatus["{#IFDESCRIPTION}"] Network interfaces WMI get NEW: Interface {“IFNAME}: Operational status NEW
                    net.speed["{#IFDESCRIPTION}"]             Network interfaces WMI get NEW: Interface {“IFNAME}: Speed NEW
                    In the latest values, there are plausible values, when filtering for the Hosts=<hostname> and Name="interface":
                    Code:
                    Interface MGW01 10.x.x.49: Bits received NEW
                    Interface MGW01 10.x.x.49: Bits sent NEW
                    Interface MGW01 10.x.x.49: Inbound packets with errors NEW
                    <etc. for MGW02, MGW03, NAS, Repl, USV>
                    So the first three item prototypes work properly.
                    However, I am still struggling to understand the concept of the keys for dependent items.
                    Playing around with the macros a bit demonstrated that the Preprocessing under 3. works, but I can not yet convert this into automatically generated, properly working and frequently updated items (most importantly "Interface {“IFNAME}: Operational status").

                    The items from item prototypes 4 and 5 are created, but with an error:
                    Name: Network Interfaces discovery NEW: MGW01 10.x.x.49: Speed NEW
                    Key: net.speed["Intel (R) Ethernet Server Adapter I350-T4 #2"]
                    Type: Dependent item
                    Status: Not supported
                    Info: Value "[{"ActiveMaximumTransmissionUnit":"1500",...

                    => How is the information loaded to "net.if.status" loaded in the original template?
                    => Or what do I have to do to make it work with the modified template?
                    Last edited by c1support; 13-04-2020, 09:59.

                    Comment

                    • c1support
                      Member
                      • Apr 2020
                      • 47

                      #11
                      In order to get the operational status, I created another UserParameter (-> see post #8 from 2020-04-12, 2. Created "net.if.discovery.ps1" on Windows Server).
                      The contents of windows.net.if.status.ps1 (will rename stuff after PoC -> see post #9 from 2020-04-12) are roughly:
                      Code:
                      $param1 = args[0] + " " + args[1]
                      $result = -1
                      $Array = "{`"data`":[`n"
                      $Array2 = @() foreach ($Adapter in (Get-WmiObject MSFT_NetAdapter -Namespace root\standardcimv2)) {  
                      $Array2 += "{`"{#IFNAME}`":`"" + $Adapter.Name + "`",`"{#IFDESCRIPTION}`":`"" + $Adapter.InterfaceDescription + "`"}`n"  
                      if ($Adapter.Name -contains $param1){
                          $result = $Adapter.InterfaceOperationalStatus
                        } }
                      $Array += $Array2 -join(",") $Array += "]}"  
                      $result
                      line 1: for some reason, I am not yet able to pass "MGW01 10.x.x.49" as one string but it is separated into two parameters
                      line 3: not necessary to create $Array, and probably will omit this as soon as PoC
                      line 5: same as line 3
                      line 6: same as line 3 (in my current version, I use $
                      Adapter.InterfaceOperationalStatus - but this won't matter for lon
                      g)

                      Next, I added the UserParameter into zabbix_agentd.conf and I restarted Zabbix Agent service.

                      Manually, the status can be requested:

                      Code:
                      sudo -u zabbix zabbix_get -s 10.x.x.49 -p 10050 -k 'windows.net.if.status["MGW01 10.x.x.49]' => 1
                      sudo -u zabbix zabbix_get -s 10.x.x.49 -p 10050 -k 'windows.net.if.status["MGW02 10.x.x.67]' => 2
                      sudo -u zabbix zabbix_get -s 10.x.x.49 -p 10050 -k 'windows.net.if.status["MGW03 10.x.x.82]' => 1
                      => seems to work

                      And I created the respective item prototype:

                      Code:
                      Network interfaces WMI get NEW: Interface {“IFNAME}: Operational status NEW25  windows.net.if.status["{#IFNAME}"]
                      So far, I have been able to initiate "Check now" with (no errors) and the items have been created. And after changing to Type=Zabbix Agent, it works:
                      - Name: Network Interfaces discovery NEW: MGW01 10.x.x.49: Operational status NEW25
                      - Key: windows.net.if.status["Intel (R) Ethernet Server Adapter I350-T4 #2"]
                      - Type: Zabbix Agent
                      - Status: Enabled
                      - Latest data: valid information

                      => I will follow up on this (hopefully within the next two days) to present the entire solution with a few brief lines.
                      Last edited by c1support; 13-04-2020, 23:45. Reason: Modified Type (Dependent item => Zabbix agent), now it works

                      Comment

                      • tim.mooney
                        Senior Member
                        • Dec 2012
                        • 1427

                        #12
                        Originally posted by c1support
                        Code:
                        $param1 = args[0] + " " + args[1]
                        $result = -1
                        $Array = "{`"data`":[`n"
                        $Array2 = @() foreach ($Adapter in (Get-WmiObject MSFT_NetAdapter -Namespace root\standardcimv2)) {
                        $Array2 += "{`"{#IFNAME}`":`"" + $Adapter.Name + "`",`"{#IFDESCRIPTION}`":`"" + $Adapter.InterfaceDescription + "`"}`n"
                        if ($Adapter.Name -contains $param1){
                        $result = $Adapter.InterfaceOperationalStatus
                        } }
                        $Array += $Array2 -join(",") $Array += "]}"
                        $result
                        line 1: for some reason, I am not yet able to pass "MGW01 10.x.x.49" as one string but it is separated into two parameters
                        line 3: not necessary to create $Array, and probably will omit this as soon as PoC
                        line 5: same as line 3
                        line 6: same as line 3 (in my current version, I use $
                        Adapter.InterfaceOperationalStatus - but this won't matter for lon
                        g)
                        Regarding your comment about line 1: you're probably having trouble because you're likely not correctly (double)quoting the argument that's passed in to your powershell script. Also, it doesn't look like (at least in Comment #8) your UserParameter specifies that it can take parameters (via the[*] after the item key). You might want to look at the examples (like Example 3) in the User Parameter documentation. Note that some of the earlier examples in the documentation also don't double quote their arguments, which is kind of a bad example to set. If you double quote the argument as it's passed to PowerShell, it should keep it as one argument, rather than space-splitting it.

                        In other words, instead of this:
                        Code:
                        UserParameter=windows.net.if.discovery,powershell.exe -executionpolicy bypass -file "C:\[LinkToScript]\net.if.discovery.ps1"
                        you probably want to try something like this:
                        Code:
                        UserParameter=windows.net.if.discovery[*],powershell.exe -executionpolicy bypass -file "C:\[LinkToScript]\net.if.discovery.ps1" "$1"
                        Also, I probably should have said this earlier: while I applaud your tenacity and am impressed with your workaround, I hope that you treat this as what I think it is: a workaround for a software feature that shouldn't have to be worked-around. In other words, you have a very detailed report that you could provide via the Zabbix bug tracker and you have an environment where you can reproduce the problem. The Zabbix developers clearly care about the quality of the software and they can't fix something they don't know is broken, so you would be doing them and potentially other future users a favor if you reported the problem and offered to help reproduce it and run tests for them if needed. If you implement your workaround and stop there, without reporting the issue via the bug tracker, it feels like a missed opportunity to help improve the software for everyone.

                        Comment

                        • c1support
                          Member
                          • Apr 2020
                          • 47

                          #13
                          Thank you very much for all the guidance (technical and cultural-wise), this is highly appreciated!

                          I fully agree with you, and this is why I voted for the feature request https://support.zabbix.com/browse/ZBXNEXT-2765 and linked to this thread.
                          Also, I linked to this thread from here: https://www.zabbix.com/forum/zabbix-...te-for-windows since I feel this is related.

                          No worries about the efforts on my side: It was a fun way to understand better the tool I am planning to rely on.

                          Thanks for the hint regarding number of parameters.
                          Depending on the reaction for the feature request, I will decide how much effort I will invest into either providing evidence towards developers OR documenting the status quo OR improving the status quo.
                          Last edited by c1support; 15-04-2020, 00:02.

                          Comment

                          • tim.mooney
                            Senior Member
                            • Dec 2012
                            • 1427

                            #14
                            Nice, I think that's a great approach, and I agree that working your way through an issue like this has given you a jump-start on understanding parts of the software.

                            Comment

                            • JtakyLR
                              Junior Member
                              • Jul 2020
                              • 4

                              #15
                              Hi, you can use my template for Zabbix 5 https://github.com/JtakyLR/zabbix
                              You need to replace Linked templates "Template Module Windows network by zabbix agent"

                              Comment

                              Working...