[ZBXNEXT-2088] Allow merging of discovered VM's and data from an installed agent Created: 2013 Dec 24 Updated: 2024 May 16 Resolved: 2022 Jul 08 |
|
Status: | Closed |
Project: | ZABBIX FEATURE REQUESTS |
Component/s: | Frontend (F), Server (S) |
Affects Version/s: | 2.2.1 |
Fix Version/s: | None |
Type: | Change Request | Priority: | Major |
Reporter: | Gene Liverman | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 103 |
Labels: | interfaces, lld, usability, vmware | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Issue Links: |
|
Description |
As it stands right now, it seems that I would have to have two copies of almost every "host" in my environment as there would be one for the discovered VMware virtual machine and another one for the data pulled by the installed agent. I have marked this as major because training users that the host they are looking for may be listed twice will be a major issue. Additionally, naming of the agent-containing host will be difficult since there can only be one of each visible name. There is a forum thread about this at https://www.zabbix.com/forum/showthread.php?t=43531 |
Comments |
Comment by Oleksii Krykun [ 2013 Dec 26 ] |
Additionally, some items are duplicated. First are discovered with VMware template and second with OS template, e.g. filesystems, network interfaces etc. |
Comment by Mickael Martin [ 2014 Jan 08 ] |
Very interresting. I would like to add VMWare informations on a host not created with autodiscovery. Maybe some fusion with two hosts... (the discovered host, the VM and the "fixed" host with zabbix agent informations) |
Comment by Tatapoum [ 2014 Feb 04 ] |
+1 Two major issues :
|
Comment by Pierre-Yves MIMAULT [ 2014 Apr 11 ] |
or at least, it would be great to add a second IP address for the discovered VM to link the zabbix agent. |
Comment by Kevin Ogden [ 2014 Jul 21 ] |
+1 This is pretty critical to me actually. Most of our server infrastructure exists as VM's now and I kinda need to be able to tie multiple templates to a discovered host so I can make use of the Zabbix agent within the VM's. We have a mix of Windows and UNIX VM's so the hosts need to be unique. A way of converting an autodiscovered host to a standard host in an easy fashion would be nice. |
Comment by Melanie te Laake [ 2014 Sep 15 ] |
+1 Same Problem here. I have a lot of host duplicates right now, because I cannot edit individual discovered virtual machines (Macros, Agent and SNMP interfaces) and link additional templates to them. Unfortunately the workaround with the duplicates causes confusion and it decreases the usability of the VMware monitoring solution. |
Comment by Yves Vogl [ 2015 Jun 02 ] |
Hi, it's open source and we are all encouraged to fix issues we encounter. But before reinventing a wheel for an issue that's 18 months old: has anyone already started to work on this issue or established an acceptable workaround? Does this still affect Zabbix 3? Or ist there a solution we could possibly backport? Thanks so far! |
Comment by Marc [ 2015 Jun 02 ] |
yves.vogl, considering current ticket status and the fact of not being found on the roadmap, I'd not expect it to be done for 3.0 or any other release. Because an implementation might not be trivial, I believe it's unlikely to be done without proper (co-)sponsoring. |
Comment by richlv [ 2015 Sep 13 ] |
(1) both active and passive agent operations should be verified (active specifically requested in |
Comment by xanadu dm [ 2016 Feb 21 ] |
Also looking for a workable solution. |
Comment by Yves Vogl [ 2016 Feb 22 ] |
I'm wondering if this can be solved by using Host prototypes. Another solution could be to solely rely on passive checks. Here you need to modify the existing templates to enable those items you'd like to trap. |
Comment by dougbee [ 2016 Mar 10 ] |
Unfortunately I don't think I can use the VMware monitoring feature because of this:
I'm definitely curious if Host prototypes would work, instead of using the UUID use the FQDN. |
Comment by Yves Vogl [ 2016 Mar 11 ] |
Hi Doug, I'm not sure if host prototypes would solve your problem. As far as I can see there's no IP detection (which also requires the VMware Guest Tools to be installed). But you need at least the IP (or a resolvable FQDN) that will be used as service endpoint for the agent. |
Comment by Michael Wilmes [ 2016 May 26 ] |
I wanted to add a technical thought, to see if this could help with this specific issue. Currently, the VMs are tracked by their instance UUID ('InstanceUUID'). This information is not immediately available to the agent in the VM. However, I am finding that the agent and vCenter both have access to the UUID property ('UUID') of the VM. It appears as a UUID formatted string in vCenter and as 'VMware-xx xx xx xx xx xx xx xx-xx xx xx xx xx xx xx xx' as the guest's serial number. I have confirmed this on CentOS 7 (file: /sys/devices/virtual/dmi/id/product_serial) and in Windows (WMI: Win32_BIOS.SerialNumber). I know this doesn't directly address being able to add additional agents for the hosts created with the templates, but I'm hoping it can help with identifying a linkage between the agent and the VM. |
Comment by Raymond Kuiper [ 2016 Jun 25 ] |
It would be possible to use the hostmetadata to report the UUID info back to zabbix server if we're using autoregistration. We'll still need a way to merge the two though. |
Comment by Jonathan ROBERT [ 2016 Nov 03 ] |
Hi, The trick with mass modifiication button might be seen as a bug. |
Comment by Dimitri Bellini [ 2016 Dec 09 ] |
After a lot of research the solution proposed by Michael Wilmes is not working for vCenter implemtation because "The instanceUUID is a new property that was introduced in the vSphere 4.0 API to provide an easy way to uniquely identify a VM" (https://blogs.vmware.com/vsphere/2012/02/uniquely-identifying-virtual-machines-in-vsphere-and-vcloud-part-1-overview.html). Actually Zabbix is using InstanceUUID and not SMBIOS UUID for the hostname VM. |
Comment by Michael Wilmes [ 2016 Dec 09 ] |
I don't think you should stop using the instanceUUID for identifying VMs, but what I was suggesting is that both the VM and vCenter have access to the UUID and can this might be used as a way to chain together the host agent running in the VM and the vCenter. Maybe add a field to the host data in the Zabbix DB and insert the shared identifier there? Update the Zabbix agent to track and send the BIOS UUID as a tracked value? Possibly use the BIOS UUID as a third option for uniquely identifying hosts during discovery? If you point me to a code repository and let me know what problems you're seeing, I would like to help. I have some coding experience, and it may be more productive for me to look at what you're seeing instead of just offering random solutions. |
Comment by boreasops [ 2017 Feb 01 ] |
+1 @Michael Wilmes - can you propose a way to extract the UUID using the hostmetadata value in zabbix_agentd.conf to enable this in auto-registration of agents? Can't seem to fathom a way to achieve this and find it crucial for our planned use case. Kind regards |
Comment by Denis Volkov [ 2017 Feb 01 ] |
According to post https://communities.vmware.com/thread/204268?start=0&tstart=0 dmidecode can show UUID in Serial number. |
Comment by Michael Wilmes [ 2017 Feb 15 ] |
@boreasops - I cannot find an option that I am happy with. Based on my research, the serial number is root-readable only. We would need to write a program with setuid to root in order to read the number, or run the Zabbix agent as root. Writing the program is probably the least painful and most secure option. It would effectively need to output the data read from /sys/devices/virtual/dmi/id/product_serial, be set uid root, but be executable by only the zabbix user group. The executable, imo, should only read from that one file and take no arguments. At that point, the agent can get the UUID and we can begin to use it. Another option might be to talk with open-vm-tools/VMware tools and try to get the information through that, but I have no idea if it would work or how to do it. As a test pilot case, I made a copy of cat that I setuid and changed the group on that executable. I DO NOT RECOMMEND ANYONE DO THIS FOR ACTUAL USE - THIS IS A PROOF OF CONCEPT. Here's my output: login as: user1 Greetings, |
Comment by Dimitri Bellini [ 2017 Feb 16 ] |
Hi Guys, Is not possible to use the workaround of "dmidecode" or "cat /sys/devices/virtual/dmi/id/product_serial", maybe i'm wrong or I have missed some parts. |
Comment by Michael Wilmes [ 2017 Feb 17 ] |
@Dimitri Bellini, The problem with SMBIOS, as @Dimitri Bellini has mentioned, is that multiple VMs in the same instance of vCenter may have the same SMBIOS value. This happens when a VM is cloned without being customized. The only truly exact manner to identify a VM is by its instance ID. I've come up with a way to work around that- the guestinfo VM configuration values. This is a mechanism supported by VMware tools and open-vm-tools that allows the VM and vCenter to exchange data. The guestinfo configuration paramaters are shared between the VM and vCenter and can be read and set by both. We can pass a value around that uniquely identifies the VM that is accessible by both the agent and through vCetner. The Instance ID would be required to get the value from vCenter, completing the loop. I would not advise placing the InstanceID into the guestinfo space. While it would be easiest, the blogs I have been reading hint that VMware intentionally did not make this value available in the host specifically to isolate the VM from the host- the VM knows nothing of the host it is running on. Also, this would require that Zabbix have write access to vCenter, which IMO is a bad thing. We can, however, have the agent write its own UUID to the guestinfo space and send that over as a value directly to Zabbix. Then Zabbix can read the value from the VM's configuration settings and match the two up. The only challenge with this is that the guestinfo value is writeable by any user account that can execute vmtoosd, which is world executable. Any user on the VM could change the stored value. Here is the command I used to set the value on my Linux VM: bash
[user1@zabbix-p1 ~]$ vmtoolsd --cmd 'info-set guestinfo.zabbix aaaa-bbbb-cccc-dddd-eeee'
Here is the PowerCLI commands I ran to retrieve the value. This can be directly translated over into an API call in Zabbix: PowerCLI
C:\> $vcenter = Connect-VIServer -Server vcenter-l1.avc.edu -Credential $vmcred
C:\> $vm = get-vm zabbix-p1
C:\> $vm.ExtensionData.Config.ExtraConfig.GetEnumerator()|?{$_.Key -eq 'guestinfo.zabbix'}
Key Value
--- -----
guestinfo.zabbix aaaa-bbbb-cccc-dddd-eeee
|
Comment by Dimitri Bellini [ 2017 Feb 17 ] |
@Michael Wilmes |
Comment by Michael Wilmes [ 2017 Feb 21 ] |
I think that I have suggested something that may work well, if we can identify a way to securely use the guestinfo mechanism as a means to complete the loop from Zabbix server to Zabbix Agent to guestinfo to vCenter to Zabbix server. This would involve confirming the data written to the guestinfo mechanism as authentic. My suggested process works like this: What this is doing: If the agent is not associated with a VM on the Zabbix server, the Zabbix server tries to identify what VM the agent is running on. If the value has been tampered with or the server has been cloned, creating duplicate agent UUIDs, the Zabbix server forces the agent to generate a new UUID so it can be reassociated. Otherwise the Zabbix server can associate the data coming in from the agent with the VM, and the agent's data can be stored with the VM's host data on the Zabbix server. When an association is made, any previous data saved by the agent as a host can be migrated over to the host object identified by the VM for continuity. Any created host for the agent can be deleted after assigned templates and saved data is migrated into the VM's host object. If it appears that the UUID is tampered with, the server does not try to continue to associate the agent's data with the VM. This should then act like a new, unknown Zabbix agent is connecting to the server. If a new host object is created, it would be cleaned up when then agent is reassociated with a VM. |
Comment by Adam Stadnick [ 2020 Sep 14 ] |
While I like the idea of merging the configs, is there merit in instead allowing people to extend the vmware discovery templates to add guest hostname and IP fields? This seems like it would be a relatively easy partial fix to implement. Hostname and IP data should be available via the sdk and VMWare tools for most VMs. I am trying to avoid running agents on every machine, so in my environment it would be sufficient for us to simply target ping, WMI, etc checks against a guest IP or hostname. Perhaps my setup is unique enough that this is not of value but I thought I'd throw it out there. |
Comment by Dimitri Bellini [ 2021 Jul 21 ] |
As of Zabbix 5.4 we now are able to monitor just well VMWare guest and also it could be possible to "merge" Guest VMs and traditional Agent based hosts using Zabbix Agent Active and {#VM.DNS}or {#VM.IP}Could be nice to provide an option to decide to leave "opened" the discovered hosts, so in this way we can easily add new templates, macros etc.. |
Comment by Marco Hofmann [ 2021 Jul 21 ] |
See also this reddit discussions about the same problem: https://www.reddit.com/r/zabbix/comments/oh49mg/zabbix_vmware_agent_monitoring/h4ok6t5/?context=8&depth=9 |
Comment by Alex Kalimulin [ 2022 Mar 10 ] |
In 5.0 we introduced LLD overrides, which allow linking different templates based on LLD macros. In 5.2 we added custom interfaces for host prototypes and also added #VM.IP and VMWare FQDN Template. All this should address initial concerns (which date back to 2.2) about having two hosts to monitor a single VM. Any objections if we consider it done and close it? |
Comment by Adam Stadnick [ 2022 Mar 11 ] |
Alex, are you saying we can modify the Vmware template to add a standard agent interface on discovered VMs? If so that's great, although I'd love to see this built in by default because I don't want to have to maintain a customized version of that template and merge my changes in for every release.
|
Comment by Dimitri Bellini [ 2022 Mar 14 ] |
Hi Alex, |
Comment by Marco Hofmann [ 2022 May 04 ] |
Kalimulin In my very personal opinion, this issue can be closed, after |
Comment by Alexei Vladishev [ 2022 Jul 08 ] |
I am going to close this ticket since Zabbix 6.2 covering requested use cases is out. Any objections? |
Comment by Marco Hofmann [ 2022 Jul 08 ] |
I'm happy. If everything works as promised with 6.2, I'm currently not aware of any more issues. |
Comment by Adam Stadnick [ 2022 Jul 08 ] |
So, just to confirm - in 6.2 if I link a template to a discovered host, can I have agent-based checks that are separate from the VMware discovery template checks? If so, that looks like a perfect solution. I haven't had a chance to update to 6.2 yet so I'm just looking for clarification. |
Comment by Alexei Vladishev [ 2022 Jul 08 ] |
astadnick Yes. In Zabbix 6.2 you can link a new template with agent-based checks to a discovered hosts having other templates. Moreover you may also add new host tags and fully control macros. |
Comment by Adam Stadnick [ 2022 Jul 08 ] |
Awesome, that's great news! I agree that this can be closed. Looking forward to 6.2 in my production environment! |
Comment by Alexei Vladishev [ 2022 Jul 08 ] |
I am closing it then. Thanks for the feedback! |
Comment by dougbee [ 2022 Sep 13 ] |
Apologies for commenting on a closed topic, but I'm wondering if the inverse situation is possible. We have an existing 6.2.2 environment with thousands of Zabbix Agents. If I add the VMware FQDN template, is it possible to have the new VMware Guest metrics merge with an already-existing Zabbix Active Agent? In other words, we have: webserver.example.com = Linux or Windows VM, monitored using only Active Agent items. The FQDN is webserver.example.com, BUT the VM name might just be "webserver". Is there a way to have Zabbix discover this as a VM, and link the VMware Guest template to the webserver.example.com Zabbix host? Thank you! |