[ZBXNEXT-7754] VMWARE. Get Full IP address list of guest VMs and assign as interfaces. Created: 2022 May 30  Updated: 2024 Oct 03  Resolved: 2023 Nov 07

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Server (S)
Affects Version/s: 6.2.0rc1
Fix Version/s: 7.0.0alpha7, 7.0 (plan)

Type: New Feature Request Priority: Medium
Reporter: Andrey Tocko (Inactive) Assignee: Michael Veksler
Resolution: Fixed Votes: 18
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File image-2023-08-29-12-05-53-272.png     PNG File image-2023-08-29-12-07-56-415.png     PNG File Скриншот 03.10.24_15.55.35.png    
Issue Links:
Duplicate
duplicates ZBXNEXT-7492 VMware discovery - VM with multiple NICs Closed
Sub-task
depends on ZBXNEXT-7738 Possibility to add additional interfa... Open
part of ZBXNEXT-6269 Set IP to vmware HV and VM Closed
Epic Link: Zabbix 7.0
Team: Team B
Sprint: Sprint 104 (Sep 2023), Sprint 105 (Oct 2023), Sprint 106 (Nov 2023)
Story Points: 0.7

 Description   

Currently discovery of Guest VMs vmware.vm.discovery returns one IP address, which is assigned as interface to host prototype. Consider possibility to fetch all the IP addresses, assigned to Guest in Vmware and add a full list as interfaces to hostprototype. For user to decide which one to use for custom checks.



 Comments   
Comment by Arch [ 2022 Jul 18 ]

A filter for which subnets are added from discovery would be appreciated for this feature if it is added(and I hope it will be).

Reason for that is some controller type VM's can have several interfaces for communication with hardware devices in different subnets. Only the management interface may be required for monitoring.

Comment by Daniel Cournoyer [ 2022 Aug 08 ]

I approve. Please add a filter to detect the IP in some subnets.

I want to auto-add all our VM, which have Zabbix-Agent2 install automatic. So in the Host prototypes of the template, I add a Interfaces Agent to connect them. But since some VM have more than one IP/VLAN, the discovery get any IP, which is not working for some.

Comment by Dimitri Bellini [ 2022 Sep 16 ]

Hi DevTeam,
I will add my +1 to this topic because seems interesting for some customers.
Thanks

Comment by Carl knibbs [ 2022 Dec 27 ]

i have the same issue, if anyone has a workround id love to know.. I'm new to zabbix, I wonder if i can put a filter on some discovery rule

Comment by Rafael Costa [ 2023 Jan 30 ]

same issue here
i hope one day a version get this feature

Comment by Sabari [ 2023 Feb 25 ]

same issue here. would like to get this feature

Comment by Jacob W Jeffers [ 2023 Jul 20 ]

We are facing the same problem with VMs that have multiple IP addresses assigned to them. This feature would be much appreciated.

Comment by Sabari [ 2023 Jul 21 ]

A workaround on this is, in the VMWare Tools config, one can use the exclude-nics config to specific the nics that needs to be excluded. 

Comment by Michael Veksler [ 2023 Aug 28 ]

Proposal:

Taken into account that representation of vm in zabbix server is required only 1 correct interface/IP (the business reason for having multiple interfaces for a VM host prototype is still unknown ), we can do the following:

  1. adding subset of vmware.vm.net.if.discovery subset to vmware.vm.discovery as "net_if" 
      "net_if": [
        {
          "ifip": ["127.0.0.1","::1"],
          "ifname": "aaa",
          "ifmac": "bbb",
          "ifconnected": true,
          "iftype": "VirtualVmxnet3",
          "ifbackingdevice": "VLAN(myLab)",
          "ifdvswitch_uuid": "ccc",
          "ifdvswitch_portgroup": "dvportgroup-111",
          "ifdvswitch_port": 123
        },
        {
          "ifip": [],
          "ifname": "aaa2",
          "ifmac": "bbb2",
          "ifconnected": false,
          "iftype": "VirtualVmxnet3",
          "ifbackingdevice": "VLAN(myLab2)",
          "ifdvswitch_uuid": "",
          "ifdvswitch_portgroup": "",
          "ifdvswitch_port": 0
        }
      ] 
  1. create a new LLD macro with required IP via JSONPath. For example based on "ifbackingdevice":
    $.net_if[?(@.ifbackingdevice=="VLAN(myLab)")].ifip[0].first() 
  1. supposed that user manually update the template of vm host prototype to use new LLD macro with correct IP

<MVekslers> The possible reason of a second interface is JMX or SNMP templates. It can be done with the same ip via second "host prototype" and "override" based on vmware tags (for example)

Comment by Dimitri Bellini [ 2023 Aug 29 ]

Hi Michael,
very good job!
The most classic "use case" it's to use the "right" IP address (i.e. management vlan) for simple ICMP Ping check or something similar.
Do you think this new improvement will be available on Zabbix 6.4.x releases or only on Zabbix 7.0?

Thanks so much

Comment by Michael Veksler [ 2023 Oct 19 ]

Available in:

Comment by Arturs Dancis [ 2023 Oct 31 ]

Documentation (7.0) updated:

Comment by Michał Panasiewicz [ 2024 Oct 01 ]

The problem that this modification to already existing machines adds a duplicate interface, which can not be removed because it is associated with existing items.

Comment by Michael Veksler [ 2024 Oct 01 ]

It's not entirely clear, this change just shows information about available IP addresses for the VMs and does not create additional interfaces

Comment by Michał Panasiewicz [ 2024 Oct 02 ]

The last point of this instruction - changing the host prototype:
https://www.zabbix.com/documentation/7.0/en/manual/vm_monitoring/example#advanced-host-interface-configuration

This point will not replace, unfortunately, the interface entries but will add another interface.
Not being able to remove the previous one because of existing items. when we change the host prototype variable in interface , and later also when we restore

{#VM.IP}
Comment by Aleksandr Kotsegubov [ 2024 Oct 03 ]

Wolvverine 

You could also try to add the "{#VM.IP}" macro to the VM discovery rule, instead of creating new macro "{#MYLAB.NET.IF}". This way, the value based on JSONPATH will replace the incoming value of the "{#VM.IP}" macro and you don't need to change the interface on the host prototype. In this case, the IP address can be replaced without errors. I tested this solution on a latest build from the master branch.

 

However, keep in mind:

  1. If you replace as I described and there is no IP address according to the specified JSONPATH (the VM will not have this VLAN), then the interface will be changed to the unexpanded macro.
  2. I haven't tested the behavior, what will happen if you already have an error about trying to delete the interface with attached items. Perhaps this solution will not help you, since you indicated that "and later also when we restore {#VM.IP}"
Generated at Tue Apr 15 09:51:45 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.