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

**URL:** https://discuss.elastic.co/t/vsphere-beats-module-inconsistent-usage-of-host-name-vs-host-id/133321
**Category:** Beats
**Tags:** metricbeat
**Created:** [May 25, 2018, 12:40pm UTC](https://discuss.elastic.co/t/vsphere-beats-module-inconsistent-usage-of-host-name-vs-host-id/133321 "2018-05-25T12:40:33Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![bogd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bogd/32/45740_2.png) [@bogd](https://discuss.elastic.co/u/bogd)
#### Post date: [May 25, 2018, 12:40pm UTC](https://discuss.elastic.co/t/vsphere-beats-module-inconsistent-usage-of-host-name-vs-host-id/133321/1 "2018-05-25T12:40:34Z")

</div>

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](https://www.elastic.co/guide/en/beats/metricbeat/current/exported-fields-vsphere.html), which specifically lists the "vsphere.virtualmachine.host" field as "hostname".

Looking at [the code](https://github.com/elastic/beats/blob/master/metricbeat/module/vsphere/virtualmachine/virtualmachine.go), 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!

---

<div class="post-metadata">

### Author: ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)
#### Post date: [May 28, 2018, 8:54am UTC](https://discuss.elastic.co/t/vsphere-beats-module-inconsistent-usage-of-host-name-vs-host-id/133321/2 "2018-05-28T08:54:12Z")

</div>

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](https://github.com/elastic/beats)

---

<div class="post-metadata">

### Author: ![bogd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bogd/32/45740_2.png) [@bogd](https://discuss.elastic.co/u/bogd)
#### Post date: [May 28, 2018, 5:13pm UTC](https://discuss.elastic.co/t/vsphere-beats-module-inconsistent-usage-of-host-name-vs-host-id/133321/3 "2018-05-28T17:13:46Z")

</div>

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 🙂

I have also raised [issue 7187](https://github.com/elastic/beats/issues/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. 😀

---

<div class="post-metadata">

### Author: ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)
#### Post date: [May 28, 2018, 7:36pm UTC](https://discuss.elastic.co/t/vsphere-beats-module-inconsistent-usage-of-host-name-vs-host-id/133321/4 "2018-05-28T19:36:41Z")

</div>

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 ❤

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [June 25, 2018, 9:43pm UTC](https://discuss.elastic.co/t/vsphere-beats-module-inconsistent-usage-of-host-name-vs-host-id/133321/5 "2018-06-25T21:43:04Z")

</div>

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