vSphere Beats module - inconsistent usage of host name vs host ID

I have recently installed the vSphere module for Beats. And I noticed a strange inconsistency regarding the "host" fields:

  • In the "host" metricset:

vsphere.host.name esx01.lab.example.com

  • In the "virtualmachine" metricset:

vsphere.virtualmachine.host host-961

It looks like the "vsphere.host.name" is using the actual hostname, and "vsphere.virtualmachine.host" is using the internal host ID (or, to be more specific, the managed object ID/managed object reference).

While it isn't difficult to map the two together manually, this requires an additional step in order to aggregate data from VMs running on the same host. Also, it seems to contradict the documentation, which specifically lists the "vsphere.virtualmachine.host" field as "hostname".

Looking at the code, the host code pulls hs.Summary.Config.Name (HostSystem.Summary.Config.Name - a string containing the host name), while the virtualmachine code pulls vm.Summary.Runtime.Host.Value (HostSystem.Value, which seems to return the host ID. Shouldn't this one also be vm.Summary.Runtime.Host.Summary.Config.Name?)

Am I missing something? Is there anything I need to configure so that the two fields contain the same thing (a host name)? If not, is there any chance this could be changed in a future release of the Beats module?

Thank you!

Thanks for bringing this up. I'm wondering if each event should contain host id and host name? The simple solution to get started would be to also add the vsphere.host.name field to the virtualmachine metricset?

Could you open an issue for this on Github? https://github.com/elastic/beats

Thank you. I actually started from the github issues page, but the official policy there says "go to the forum first". And so I did :slightly_smiling_face:

I have also raised issue 7187, as per your recommendation.

I don't expect a change to vsphere.virtualmachine.host (might break existing implementations). But if someone could add a new metric for the hostname (maybe vsphere.virtualmachine.hostname?), that would be extremely useful.

As you said, adding the host ID to the host metricset might also be useful (vsphere.host.id?) . Personally, I have never worked directly with host IDs, but chances are there is someone out there who can use them. :grinning:

Hi bogd

Thanks a lot for following the recommendation of the Github issue and opening a topic here first. You did exactly as we hope everyone would do :heart:

Let's continue the discussion on the Github issue from now.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.