Skip to content

Commit

Permalink
[vSphere] Add id field to all the metricsets (#41097)
Browse files Browse the repository at this point in the history
* add id field

* update changelog

* fix unit test

* update field descriptions

* update fields.asci

* fix lint

* address review comments

* update fields.asci
  • Loading branch information
niraj-elastic authored Oct 22, 2024
1 parent 7ca9893 commit ec92e02
Show file tree
Hide file tree
Showing 32 changed files with 200 additions and 37 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Added Cisco Meraki module {pull}40836[40836]
- Added Palo Alto Networks module {pull}40686[40686]
- Restore docker.network.in.* and docker.network.out.* fields in docker module {pull}40968[40968]
- Add `id` field to all the vSphere metricsets. {pull}41097[41097]
- Only watch metadata for ReplicaSets in metricbeat k8s module {pull}41289[41289]

*Metricbeat*
Expand Down
102 changes: 86 additions & 16 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -67030,7 +67030,7 @@ Cluster information.
*`vsphere.cluster.datastore.names`*::
+
--
List of all the Datastore names associated with the cluster.
List of all the datastore names associated with the cluster.


type: keyword
Expand All @@ -67040,7 +67040,7 @@ type: keyword
*`vsphere.cluster.datastore.count`*::
+
--
Number of Datastores associated with the cluster.
Number of datastores associated with the cluster.


type: long
Expand Down Expand Up @@ -67072,7 +67072,7 @@ type: boolean
*`vsphere.cluster.host.count`*::
+
--
Number of Hosts associated with the cluster.
Number of hosts associated with the cluster.


type: long
Expand All @@ -67082,7 +67082,17 @@ type: long
*`vsphere.cluster.host.names`*::
+
--
List of all the Host names associated with the cluster.
List of all the host names associated with the cluster.


type: keyword

--

*`vsphere.cluster.id`*::
+
--
Unique cluster ID.


type: keyword
Expand All @@ -67103,7 +67113,7 @@ type: keyword
*`vsphere.cluster.network.count`*::
+
--
Number of Networks associated with the cluster.
Number of networks associated with the cluster.


type: long
Expand All @@ -67113,7 +67123,7 @@ type: long
*`vsphere.cluster.network.names`*::
+
--
List of all the Network names associated with the cluster.
List of all the network names associated with the cluster.


type: keyword
Expand Down Expand Up @@ -67247,6 +67257,16 @@ type: long
List of all the host names.


type: keyword

--

*`vsphere.datastore.id`*::
+
--
Unique datastore ID.


type: keyword

--
Expand Down Expand Up @@ -67332,10 +67352,20 @@ Datastore Cluster



*`vsphere.datastorecluster.id`*::
+
--
Unique datastore cluster ID.


type: keyword

--

*`vsphere.datastorecluster.name`*::
+
--
The Datastore Cluster name.
The datastore cluster name.


type: keyword
Expand Down Expand Up @@ -67369,7 +67399,7 @@ format: bytes
*`vsphere.datastorecluster.datastore.names`*::
+
--
List of all the Datastore names associated with the Datastore Cluster.
List of all the datastore names associated with the datastore cluster.


type: keyword
Expand All @@ -67379,7 +67409,7 @@ type: keyword
*`vsphere.datastorecluster.datastore.count`*::
+
--
Number of datastores in the Datastore Cluster.
Number of datastores in the datastore cluster.


type: long
Expand Down Expand Up @@ -67521,6 +67551,16 @@ format: bytes

--

*`vsphere.host.id`*::
+
--
Unique host ID.


type: keyword

--

*`vsphere.host.memory.free.bytes`*::
+
--
Expand Down Expand Up @@ -67841,6 +67881,16 @@ type: long

--

*`vsphere.network.id`*::
+
--
Unique network ID.


type: keyword

--

*`vsphere.network.name`*::
+
--
Expand All @@ -67854,7 +67904,7 @@ type: keyword
*`vsphere.network.status`*::
+
--
General health of the Network.
General health of the network.


type: keyword
Expand Down Expand Up @@ -67951,6 +68001,16 @@ type: long

--

*`vsphere.resourcepool.id`*::
+
--
Unique resource pool ID.


type: keyword

--



*`vsphere.resourcepool.memory.usage.guest.bytes`*::
Expand Down Expand Up @@ -68162,14 +68222,24 @@ type: keyword
Hostname of the host.


type: keyword

--

*`vsphere.virtualmachine.id`*::
+
--
Unique virtual machine ID.


type: keyword

--

*`vsphere.virtualmachine.name`*::
+
--
Virtual Machine name.
Virtual machine name.


type: keyword
Expand All @@ -68179,7 +68249,7 @@ type: keyword
*`vsphere.virtualmachine.os`*::
+
--
Virtual Machine Operating System name.
Virtual machine Operating System name.


type: keyword
Expand Down Expand Up @@ -68219,7 +68289,7 @@ type: long
*`vsphere.virtualmachine.memory.used.guest.bytes`*::
+
--
Used Memory of Guest in bytes.
Used memory of Guest in bytes.


type: long
Expand All @@ -68231,7 +68301,7 @@ format: bytes
*`vsphere.virtualmachine.memory.used.host.bytes`*::
+
--
Used Memory of Host in bytes.
Used memory of Host in bytes.


type: long
Expand All @@ -68243,7 +68313,7 @@ format: bytes
*`vsphere.virtualmachine.memory.total.guest.bytes`*::
+
--
Total Memory of Guest in bytes.
Total memory of Guest in bytes.


type: long
Expand All @@ -68255,7 +68325,7 @@ format: bytes
*`vsphere.virtualmachine.memory.free.guest.bytes`*::
+
--
Free Memory of Guest in bytes.
Free memory of Guest in bytes.


type: long
Expand Down
1 change: 1 addition & 0 deletions metricbeat/module/vsphere/cluster/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"entity_name": "121.0.0.0"
}
],
"id": "domain-c1",
"name": "Cluster_1",
"das_config": {
"enabled": false,
Expand Down
16 changes: 10 additions & 6 deletions metricbeat/module/vsphere/cluster/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
- name: names
type: keyword
description: >
List of all the Datastore names associated with the cluster.
List of all the datastore names associated with the cluster.
- name: count
type: long
description: >
Number of Datastores associated with the cluster.
Number of datastores associated with the cluster.
- name: das_config
type: group
fields:
Expand All @@ -32,11 +32,15 @@
- name: count
type: long
description: >
Number of Hosts associated with the cluster.
Number of hosts associated with the cluster.
- name: names
type: keyword
description: >
List of all the Host names associated with the cluster.
List of all the host names associated with the cluster.
- name: id
type: keyword
description: >
Unique cluster ID.
- name: name
type: keyword
description: >
Expand All @@ -47,11 +51,11 @@
- name: count
type: long
description: >
Number of Networks associated with the cluster.
Number of networks associated with the cluster.
- name: names
type: keyword
description: >
List of all the Network names associated with the cluster.
List of all the network names associated with the cluster.
- name: triggered_alarms.*
type: object
object_type: keyword
Expand Down
1 change: 1 addition & 0 deletions metricbeat/module/vsphere/cluster/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func TestFetchEventContents(t *testing.T) {

testEvent := mapstr.M{
"name": "DC0_C0",
"id": "domain-c29",
"host": mapstr.M{
"count": 3,
"names": []string{"DC0_C0_H0", "DC0_C0_H1", "DC0_C0_H2"},
Expand Down
1 change: 1 addition & 0 deletions metricbeat/module/vsphere/cluster/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (

func (m *ClusterMetricSet) mapEvent(cl mo.ClusterComputeResource, data *metricData) mapstr.M {
event := mapstr.M{
"id": cl.Self.Value,
"host": mapstr.M{
"count": len(data.assetNames.outputHostNames),
"names": data.assetNames.outputHostNames,
Expand Down
6 changes: 6 additions & 0 deletions metricbeat/module/vsphere/cluster/data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ func TestEventMapping(t *testing.T) {
ComputeResource: mo.ComputeResource{
ManagedEntity: mo.ManagedEntity{
Name: "Cluster_0",
ExtensibleManagedObject: mo.ExtensibleManagedObject{
Self: types.ManagedObjectReference{
Value: "CS_0",
},
},
},
},
Configuration: types.ClusterConfigInfo{
Expand Down Expand Up @@ -64,6 +69,7 @@ func TestEventMapping(t *testing.T) {
},
},
"name": "Cluster_0",
"id": "CS_0",
"host": mapstr.M{
"count": 1,
"names": []string{"Host_0"},
Expand Down
3 changes: 2 additions & 1 deletion metricbeat/module/vsphere/datastore/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
}
},
"fstype": "local",
"name": "LocalDS_0"
"name": "LocalDS_0",
"id": "datastore-0"
}
}
}
5 changes: 4 additions & 1 deletion metricbeat/module/vsphere/datastore/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
type: keyword
description: >
List of all the host names.
- name: id
type: keyword
description: >
Unique datastore ID.
- name: name
type: keyword
description: >
Expand Down Expand Up @@ -82,4 +86,3 @@
description: >
Rate of writing data to the datastore.
format: bytes

1 change: 1 addition & 0 deletions metricbeat/module/vsphere/datastore/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
func (m *DataStoreMetricSet) mapEvent(ds mo.Datastore, data *metricData) mapstr.M {
event := mapstr.M{
"name": ds.Summary.Name,
"id": ds.Self.Value,
"fstype": ds.Summary.Type,
"status": ds.OverallStatus,
"host": mapstr.M{
Expand Down
Loading

0 comments on commit ec92e02

Please sign in to comment.