From cc4f9512b71927a1ec91a680c20eab855f934d07 Mon Sep 17 00:00:00 2001 From: Liam Thompson <32779855+leemthompo@users.noreply.github.com> Date: Mon, 21 Oct 2024 17:24:09 +0200 Subject: [PATCH 1/3] [DOCS] Fix typo in changelog (#41315) h/t @lhirlimann --- CHANGELOG.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index ab562abbb54..449bc30dd52 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -474,7 +474,7 @@ https://github.com/elastic/beats/compare/v8.13.2\...v8.13.3[View commits] *Metricbeat* -- Add new fields to configure the lease duration, retry and renew when using leader elector with Kubernetes autodiscover.{pull}38471[38471] +- Add new fields to configure the lease duration, retry and renew when using leader elector with Kubernetes autodiscover. {pull}38471[38471] [[release-notes-8.13.2]] From 7ca9893ca0f1e482a3667801f29e6239edfd0127 Mon Sep 17 00:00:00 2001 From: Vinit Chauhan Date: Mon, 21 Oct 2024 13:00:14 -0400 Subject: [PATCH 2/3] [Filebeat][udp] - Remove unnecessary multiplication (#41211) Remove unnecessary multiplication --------- Co-authored-by: Denis Co-authored-by: Kush Rana <89848966+kush-elastic@users.noreply.github.com> --- filebeat/inputsource/udp/server.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/filebeat/inputsource/udp/server.go b/filebeat/inputsource/udp/server.go index 75c74a1f3d0..3a0b429f851 100644 --- a/filebeat/inputsource/udp/server.go +++ b/filebeat/inputsource/udp/server.go @@ -20,8 +20,6 @@ package udp import ( "net" - "github.com/dustin/go-humanize" - "github.com/elastic/beats/v7/filebeat/inputsource" "github.com/elastic/beats/v7/filebeat/inputsource/common/dgram" "github.com/elastic/elastic-agent-libs/logp" @@ -62,12 +60,13 @@ func (u *Server) createConn() (net.PacketConn, error) { if err != nil { return nil, err } - socketSize := int(u.config.ReadBuffer) * humanize.KiByte - if socketSize != 0 { + + if int(u.config.ReadBuffer) != 0 { if err := listener.SetReadBuffer(int(u.config.ReadBuffer)); err != nil { return nil, err } } + u.localaddress = listener.LocalAddr().String() return listener, err From ec92e0213d00cd50d54d5880a57f34ba4cbe0c0a Mon Sep 17 00:00:00 2001 From: niraj-elastic <124254029+niraj-elastic@users.noreply.github.com> Date: Tue, 22 Oct 2024 11:12:45 +0530 Subject: [PATCH 3/3] [vSphere] Add id field to all the metricsets (#41097) * add id field * update changelog * fix unit test * update field descriptions * update fields.asci * fix lint * address review comments * update fields.asci --- CHANGELOG.next.asciidoc | 1 + metricbeat/docs/fields.asciidoc | 102 +++++++++++++++--- .../module/vsphere/cluster/_meta/data.json | 1 + .../module/vsphere/cluster/_meta/fields.yml | 16 +-- .../module/vsphere/cluster/cluster_test.go | 1 + metricbeat/module/vsphere/cluster/data.go | 1 + .../module/vsphere/cluster/data_test.go | 6 ++ .../module/vsphere/datastore/_meta/data.json | 3 +- .../module/vsphere/datastore/_meta/fields.yml | 5 +- metricbeat/module/vsphere/datastore/data.go | 1 + .../module/vsphere/datastore/data_test.go | 6 ++ .../vsphere/datastorecluster/_meta/data.json | 1 + .../vsphere/datastorecluster/_meta/fields.yml | 10 +- .../module/vsphere/datastorecluster/data.go | 1 + .../vsphere/datastorecluster/data_test.go | 8 ++ metricbeat/module/vsphere/fields.go | 2 +- .../module/vsphere/host/_meta/data.json | 1 + .../module/vsphere/host/_meta/fields.yml | 4 + metricbeat/module/vsphere/host/data.go | 1 + metricbeat/module/vsphere/host/data_test.go | 10 ++ .../module/vsphere/network/_meta/data.json | 1 + .../module/vsphere/network/_meta/fields.yml | 6 +- metricbeat/module/vsphere/network/data.go | 1 + .../module/vsphere/network/data_test.go | 6 +- .../vsphere/resourcepool/_meta/data.json | 1 + .../vsphere/resourcepool/_meta/fields.yml | 4 + .../module/vsphere/resourcepool/data.go | 1 + .../module/vsphere/resourcepool/data_test.go | 10 +- .../vsphere/virtualmachine/_meta/data.json | 1 + .../vsphere/virtualmachine/_meta/fields.yml | 16 +-- .../module/vsphere/virtualmachine/data.go | 1 + .../vsphere/virtualmachine/data_test.go | 8 ++ 32 files changed, 200 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 8eebaa31137..bac0ca314e8 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -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* diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index 783e19ffe97..915cfa33f0a 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -67247,6 +67257,16 @@ type: long List of all the host names. +type: keyword + +-- + +*`vsphere.datastore.id`*:: ++ +-- +Unique datastore ID. + + type: keyword -- @@ -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 @@ -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 @@ -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 @@ -67521,6 +67551,16 @@ format: bytes -- +*`vsphere.host.id`*:: ++ +-- +Unique host ID. + + +type: keyword + +-- + *`vsphere.host.memory.free.bytes`*:: + -- @@ -67841,6 +67881,16 @@ type: long -- +*`vsphere.network.id`*:: ++ +-- +Unique network ID. + + +type: keyword + +-- + *`vsphere.network.name`*:: + -- @@ -67854,7 +67904,7 @@ type: keyword *`vsphere.network.status`*:: + -- -General health of the Network. +General health of the network. type: keyword @@ -67951,6 +68001,16 @@ type: long -- +*`vsphere.resourcepool.id`*:: ++ +-- +Unique resource pool ID. + + +type: keyword + +-- + *`vsphere.resourcepool.memory.usage.guest.bytes`*:: @@ -68162,6 +68222,16 @@ type: keyword Hostname of the host. +type: keyword + +-- + +*`vsphere.virtualmachine.id`*:: ++ +-- +Unique virtual machine ID. + + type: keyword -- @@ -68169,7 +68239,7 @@ type: keyword *`vsphere.virtualmachine.name`*:: + -- -Virtual Machine name. +Virtual machine name. type: keyword @@ -68179,7 +68249,7 @@ type: keyword *`vsphere.virtualmachine.os`*:: + -- -Virtual Machine Operating System name. +Virtual machine Operating System name. type: keyword @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/metricbeat/module/vsphere/cluster/_meta/data.json b/metricbeat/module/vsphere/cluster/_meta/data.json index d704ceb865a..67d0e742d15 100644 --- a/metricbeat/module/vsphere/cluster/_meta/data.json +++ b/metricbeat/module/vsphere/cluster/_meta/data.json @@ -49,6 +49,7 @@ "entity_name": "121.0.0.0" } ], + "id": "domain-c1", "name": "Cluster_1", "das_config": { "enabled": false, diff --git a/metricbeat/module/vsphere/cluster/_meta/fields.yml b/metricbeat/module/vsphere/cluster/_meta/fields.yml index 27025e92848..ce72f97fe8f 100644 --- a/metricbeat/module/vsphere/cluster/_meta/fields.yml +++ b/metricbeat/module/vsphere/cluster/_meta/fields.yml @@ -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: @@ -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: > @@ -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 diff --git a/metricbeat/module/vsphere/cluster/cluster_test.go b/metricbeat/module/vsphere/cluster/cluster_test.go index 37e286c113d..3fa1b534c79 100644 --- a/metricbeat/module/vsphere/cluster/cluster_test.go +++ b/metricbeat/module/vsphere/cluster/cluster_test.go @@ -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"}, diff --git a/metricbeat/module/vsphere/cluster/data.go b/metricbeat/module/vsphere/cluster/data.go index a15e48377b5..286e4dbb2d8 100644 --- a/metricbeat/module/vsphere/cluster/data.go +++ b/metricbeat/module/vsphere/cluster/data.go @@ -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, diff --git a/metricbeat/module/vsphere/cluster/data_test.go b/metricbeat/module/vsphere/cluster/data_test.go index 6736b8b33f7..2886e376f7a 100644 --- a/metricbeat/module/vsphere/cluster/data_test.go +++ b/metricbeat/module/vsphere/cluster/data_test.go @@ -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{ @@ -64,6 +69,7 @@ func TestEventMapping(t *testing.T) { }, }, "name": "Cluster_0", + "id": "CS_0", "host": mapstr.M{ "count": 1, "names": []string{"Host_0"}, diff --git a/metricbeat/module/vsphere/datastore/_meta/data.json b/metricbeat/module/vsphere/datastore/_meta/data.json index dc690b8d40e..12f9ab59ad1 100644 --- a/metricbeat/module/vsphere/datastore/_meta/data.json +++ b/metricbeat/module/vsphere/datastore/_meta/data.json @@ -58,7 +58,8 @@ } }, "fstype": "local", - "name": "LocalDS_0" + "name": "LocalDS_0", + "id": "datastore-0" } } } \ No newline at end of file diff --git a/metricbeat/module/vsphere/datastore/_meta/fields.yml b/metricbeat/module/vsphere/datastore/_meta/fields.yml index a9b9352f67f..681a19d505e 100644 --- a/metricbeat/module/vsphere/datastore/_meta/fields.yml +++ b/metricbeat/module/vsphere/datastore/_meta/fields.yml @@ -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: > @@ -82,4 +86,3 @@ description: > Rate of writing data to the datastore. format: bytes - diff --git a/metricbeat/module/vsphere/datastore/data.go b/metricbeat/module/vsphere/datastore/data.go index 1950d32a474..0a55984c51b 100644 --- a/metricbeat/module/vsphere/datastore/data.go +++ b/metricbeat/module/vsphere/datastore/data.go @@ -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{ diff --git a/metricbeat/module/vsphere/datastore/data_test.go b/metricbeat/module/vsphere/datastore/data_test.go index 23189e3e49f..1fb3d4ef853 100644 --- a/metricbeat/module/vsphere/datastore/data_test.go +++ b/metricbeat/module/vsphere/datastore/data_test.go @@ -37,6 +37,11 @@ func TestEventMapping(t *testing.T) { }, ManagedEntity: mo.ManagedEntity{ OverallStatus: "green", + ExtensibleManagedObject: mo.ExtensibleManagedObject{ + Self: types.ManagedObjectReference{ + Value: "DS_1", + }, + }, }, Host: []types.DatastoreHostMount{}, Vm: []types.ManagedObjectReference{ @@ -61,6 +66,7 @@ func TestEventMapping(t *testing.T) { outputEvent := (&DataStoreMetricSet{}).mapEvent(datastoreTest, &metricDataTest) testEvent := mapstr.M{ "fstype": "local", + "id": "DS_1", "status": types.ManagedEntityStatus("green"), "name": "datastore-test", "host": mapstr.M{ diff --git a/metricbeat/module/vsphere/datastorecluster/_meta/data.json b/metricbeat/module/vsphere/datastorecluster/_meta/data.json index 10a4d2f98de..dd44a7c435d 100644 --- a/metricbeat/module/vsphere/datastorecluster/_meta/data.json +++ b/metricbeat/module/vsphere/datastorecluster/_meta/data.json @@ -15,6 +15,7 @@ }, "vsphere": { "datastorecluster": { + "id": "group-p1", "name": "datastore_cluster1", "capacity": { "bytes": 8795019280384 diff --git a/metricbeat/module/vsphere/datastorecluster/_meta/fields.yml b/metricbeat/module/vsphere/datastorecluster/_meta/fields.yml index 9fcceb295ad..7edad537dbd 100644 --- a/metricbeat/module/vsphere/datastorecluster/_meta/fields.yml +++ b/metricbeat/module/vsphere/datastorecluster/_meta/fields.yml @@ -4,10 +4,14 @@ description: > Datastore Cluster fields: + - name: id + type: keyword + description: > + Unique datastore cluster ID. - name: name type: keyword description: > - The Datastore Cluster name. + The datastore cluster name. - name: capacity.bytes type: long description: > @@ -21,11 +25,11 @@ - name: datastore.names type: keyword description: > - List of all the Datastore names associated with the Datastore Cluster. + List of all the datastore names associated with the datastore cluster. - name: datastore.count type: long description: > - Number of datastores in the Datastore Cluster. + Number of datastores in the datastore cluster. - name: triggered_alarms.* type: object object_type: keyword diff --git a/metricbeat/module/vsphere/datastorecluster/data.go b/metricbeat/module/vsphere/datastorecluster/data.go index 3dcce129e56..1b4789aee53 100644 --- a/metricbeat/module/vsphere/datastorecluster/data.go +++ b/metricbeat/module/vsphere/datastorecluster/data.go @@ -26,6 +26,7 @@ import ( func (m *DatastoreClusterMetricSet) mapEvent(datastoreCluster mo.StoragePod, data *metricData) mapstr.M { event := mapstr.M{ "name": datastoreCluster.Name, + "id": datastoreCluster.Self.Value, "capacity": mapstr.M{ "bytes": datastoreCluster.Summary.Capacity, }, diff --git a/metricbeat/module/vsphere/datastorecluster/data_test.go b/metricbeat/module/vsphere/datastorecluster/data_test.go index 41d1736777e..05f43ef002d 100644 --- a/metricbeat/module/vsphere/datastorecluster/data_test.go +++ b/metricbeat/module/vsphere/datastorecluster/data_test.go @@ -34,6 +34,11 @@ func TestEventMapping(t *testing.T) { Folder: mo.Folder{ ManagedEntity: mo.ManagedEntity{ Name: "Folder1", + ExtensibleManagedObject: mo.ExtensibleManagedObject{ + Self: types.ManagedObjectReference{ + Value: "FL_0", + }, + }, }, }, } @@ -43,6 +48,9 @@ func TestEventMapping(t *testing.T) { name, _ := event.GetValue("name") assert.Equal(t, "Folder1", name) + id, _ := event.GetValue("id") + assert.Equal(t, "FL_0", id) + capacity, _ := event.GetValue("capacity.bytes") assert.Equal(t, int64(100), capacity) diff --git a/metricbeat/module/vsphere/fields.go b/metricbeat/module/vsphere/fields.go index 7e3988627f8..c67607c6100 100644 --- a/metricbeat/module/vsphere/fields.go +++ b/metricbeat/module/vsphere/fields.go @@ -32,5 +32,5 @@ func init() { // AssetVsphere returns asset data. // This is the base64 encoded zlib format compressed contents of module/vsphere. func AssetVsphere() string { - return "eJzUXM1u4zgSvvdTFOay04u0HyCHBXrTmOkBNj2DTibXoEyVLW4oUktSNtxPvyApybL1Y1um1LEPOTgy66v/YrGoT/BGu3vYmDwlTR8ALLeC7uGXzZP/5pcPAAkZpnluuZL38K8PAADlfyFTSSHczzQJQkP3sMYPACtOIjH3/tFPIDGjJgn3sbvcPaxVkZffdFA5XKi5GBOFsaTr77sWdJ8a1pIsNr7vJBY+D2Fp4HKldIbukUXjgWNETVQJWjRW1UwOY+tbrbmi+2ta/61WfKPdVumk4/8D/FWf/3BjQa0AhQCbEnypwAeigMYoxtFSAltuU/9MKfZFL16mCml78Qol1+PAfiuyJWkHt4Z5AcK9fswrU3LFj1GMVxAmGTfG2QhT0molFiRxKahLKYHKUilBKMfJ4Q+ZcIaWDGxTsilpMFZzZvc4oMQB3EAJpV9dM2OtosbXz7AitIWmXpQVwlSZY3sar6zprfOrMnak68zo6g7lpV7ehNmpkG6EJ9BVwdat2kOP7FbptxuygW8B8fs3gxLoWEuwmq/XpCl5RYE6M4t/dipJLf9L7Fji4cvXKyznmJkaDZRoWjVDV3butqMB0l2LHNY+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IiWIb9yqZc337NMbkBlWKJPz+jmvcGpr4+LGS0CdvO1vGOSyxHtbsWg9Zyg0CM9onOc2KfxdMuUAbIc2oxnpn2z4aCVUK7/Gu4PCxkaAKa4DPD5ftIlRmuUIdGoE7yvWJftRw2xCsFNkw2Z6tfn4Y60zTXaQSrabiXv1wvYd5EVt6b9AmK0+RBnQBM/ccR0C81iZeyWrJ6dE23gD94Ern31iKenrUaTtAHGvxt7cGXuFluegJXxHJt0NZeBR1gr7L4e4+z3HQ8wHV8CS0jBiwD6n+maMi7gL1oz8jHbiHO/HNu3T2m3c/UKPanAgh8hW8LxvCOFlyPEq8fScg3FO7SAVl2iNXZSstzgWGYJ8sEtbyxmmUuyDxBetNLLpknRnGR+uu18QDSwttZPbid7M5c4Y7R7jcRt/bxZKrem/r3pl1c0W3dVW/Ogfez5Xe30tbT8EZnvOCq1BQ35sZ359+xqKcqnz9c790JSLZK19POgiMPsfZTHCW05HNBGdAKoLkOpURiwyxkp1SD4ZDN5wWvjsy+IqGMF7bccWLrl/JMp/1un5KbavnIbmWivmfAAAA//9lhV/l" } diff --git a/metricbeat/module/vsphere/host/_meta/data.json b/metricbeat/module/vsphere/host/_meta/data.json index 0034692e95b..d5ed7a50213 100644 --- a/metricbeat/module/vsphere/host/_meta/data.json +++ b/metricbeat/module/vsphere/host/_meta/data.json @@ -167,6 +167,7 @@ "network_names": [ "VM Network" ], + "id": "host-0", "name": "DC0_H0", "status": "green", "uptime": 1728865 diff --git a/metricbeat/module/vsphere/host/_meta/fields.yml b/metricbeat/module/vsphere/host/_meta/fields.yml index e466ef19e2a..98246507da7 100644 --- a/metricbeat/module/vsphere/host/_meta/fields.yml +++ b/metricbeat/module/vsphere/host/_meta/fields.yml @@ -52,6 +52,10 @@ description: > Sum of disk read and write rates each second in bytes. format: bytes + - name: id + type: keyword + description: > + Unique host ID. - name: memory.free.bytes type: long description: > diff --git a/metricbeat/module/vsphere/host/data.go b/metricbeat/module/vsphere/host/data.go index d877ac78af8..252218eec13 100644 --- a/metricbeat/module/vsphere/host/data.go +++ b/metricbeat/module/vsphere/host/data.go @@ -27,6 +27,7 @@ func (m *HostMetricSet) mapEvent(hs mo.HostSystem, data *metricData) mapstr.M { const bytesMultiplier int64 = 1024 * 1024 event := mapstr.M{ "name": hs.Summary.Config.Name, + "id": hs.Self.Value, "status": hs.Summary.OverallStatus, "uptime": hs.Summary.QuickStats.Uptime, "cpu": mapstr.M{"used": mapstr.M{"mhz": hs.Summary.QuickStats.OverallCpuUsage}}, diff --git a/metricbeat/module/vsphere/host/data_test.go b/metricbeat/module/vsphere/host/data_test.go index 8116fe417aa..3de32d10436 100644 --- a/metricbeat/module/vsphere/host/data_test.go +++ b/metricbeat/module/vsphere/host/data_test.go @@ -29,6 +29,13 @@ import ( func TestEventMapping(t *testing.T) { var m *HostMetricSet HostSystemTest := mo.HostSystem{ + ManagedEntity: mo.ManagedEntity{ + ExtensibleManagedObject: mo.ExtensibleManagedObject{ + Self: types.ManagedObjectReference{ + Value: "ha-host", + }, + }, + }, Summary: types.HostListSummary{ Host: &types.ManagedObjectReference{Type: "HostSystem", Value: "ha-host"}, Hardware: &types.HostHardwareSummary{ @@ -81,6 +88,9 @@ func TestEventMapping(t *testing.T) { cpuTotal, _ := event.GetValue("cpu.total.mhz") assert.EqualValues(t, 4588, cpuTotal) + id, _ := event.GetValue("id") + assert.EqualValues(t, "ha-host", id) + cpuFree, _ := event.GetValue("cpu.free.mhz") assert.EqualValues(t, 4521, cpuFree) diff --git a/metricbeat/module/vsphere/network/_meta/data.json b/metricbeat/module/vsphere/network/_meta/data.json index 317fec00756..164ba4c2ae2 100644 --- a/metricbeat/module/vsphere/network/_meta/data.json +++ b/metricbeat/module/vsphere/network/_meta/data.json @@ -22,6 +22,7 @@ ], "count": 2 }, + "id": "network-1", "name": "VM Network", "status": "green", "accessible": true, diff --git a/metricbeat/module/vsphere/network/_meta/fields.yml b/metricbeat/module/vsphere/network/_meta/fields.yml index 66373f8b188..2394bc7a3f4 100644 --- a/metricbeat/module/vsphere/network/_meta/fields.yml +++ b/metricbeat/module/vsphere/network/_meta/fields.yml @@ -23,6 +23,10 @@ type: long description: > Number of hosts connected to this network. + - name: id + type: keyword + description: > + Unique network ID. - name: name type: keyword description: > @@ -30,7 +34,7 @@ - name: status type: keyword description: > - General health of the Network. + General health of the network. - name: type type: keyword description: > diff --git a/metricbeat/module/vsphere/network/data.go b/metricbeat/module/vsphere/network/data.go index 7f3605d25ab..b640e3a9ce2 100644 --- a/metricbeat/module/vsphere/network/data.go +++ b/metricbeat/module/vsphere/network/data.go @@ -26,6 +26,7 @@ import ( func (m *NetworkMetricSet) mapEvent(net mo.Network, data *metricData) mapstr.M { event := mapstr.M{} + event.Put("id", net.Self.Value) event.Put("name", net.Name) event.Put("status", net.OverallStatus) event.Put("accessible", net.Summary.GetNetworkSummary().Accessible) diff --git a/metricbeat/module/vsphere/network/data_test.go b/metricbeat/module/vsphere/network/data_test.go index fb7c2120817..7a9b625529c 100644 --- a/metricbeat/module/vsphere/network/data_test.go +++ b/metricbeat/module/vsphere/network/data_test.go @@ -36,7 +36,8 @@ func TestEventMapping(t *testing.T) { ConfigStatus: "green", ExtensibleManagedObject: mo.ExtensibleManagedObject{ Self: types.ManagedObjectReference{ - Type: "Network", + Type: "Network", + Value: "NT_0", }, }, }, @@ -54,6 +55,9 @@ func TestEventMapping(t *testing.T) { name, _ := event.GetValue("name") assert.NotNil(t, name) + id, _ := event.GetValue("id") + assert.EqualValues(t, "NT_0", id) + status, _ := event.GetValue("status") assert.Equal(t, types.ManagedEntityStatus("green"), status) diff --git a/metricbeat/module/vsphere/resourcepool/_meta/data.json b/metricbeat/module/vsphere/resourcepool/_meta/data.json index a16e9d59197..92825ce14b7 100644 --- a/metricbeat/module/vsphere/resourcepool/_meta/data.json +++ b/metricbeat/module/vsphere/resourcepool/_meta/data.json @@ -15,6 +15,7 @@ }, "vsphere": { "resourcepool": { + "id": "resgroup-30", "name": "Resources", "status": "green", "vm": { diff --git a/metricbeat/module/vsphere/resourcepool/_meta/fields.yml b/metricbeat/module/vsphere/resourcepool/_meta/fields.yml index 2df15df42e1..20d9676893b 100644 --- a/metricbeat/module/vsphere/resourcepool/_meta/fields.yml +++ b/metricbeat/module/vsphere/resourcepool/_meta/fields.yml @@ -26,6 +26,10 @@ type: long description: > The static CPU resource entitlement for a virtual machine. + - name: id + type: keyword + description: > + Unique resource pool ID. - name: memory type: group fields: diff --git a/metricbeat/module/vsphere/resourcepool/data.go b/metricbeat/module/vsphere/resourcepool/data.go index 839e2669c69..76bb17cc67c 100644 --- a/metricbeat/module/vsphere/resourcepool/data.go +++ b/metricbeat/module/vsphere/resourcepool/data.go @@ -32,6 +32,7 @@ func (m *ResourcePoolMetricSet) mapEvent(rp mo.ResourcePool, data *metricData) m event := mapstr.M{ "name": rp.Name, "status": rp.OverallStatus, + "id": rp.Self.Value, } quickStats := rp.Summary.GetResourcePoolSummary().QuickStats diff --git a/metricbeat/module/vsphere/resourcepool/data_test.go b/metricbeat/module/vsphere/resourcepool/data_test.go index ce7ccec484e..48e85f1c2ba 100644 --- a/metricbeat/module/vsphere/resourcepool/data_test.go +++ b/metricbeat/module/vsphere/resourcepool/data_test.go @@ -31,6 +31,11 @@ func TestEventMapping(t *testing.T) { ManagedEntity: mo.ManagedEntity{ OverallStatus: "green", Name: "resourcepool-test", + ExtensibleManagedObject: mo.ExtensibleManagedObject{ + Self: types.ManagedObjectReference{ + Value: "RS_0", + }, + }, }, Summary: &types.ResourcePoolSummary{ QuickStats: &types.ResourcePoolQuickStats{ @@ -70,7 +75,10 @@ func TestEventMapping(t *testing.T) { status, _ := event.GetValue("status") assert.EqualValues(t, "green", status) - name := event["name"].(string) + id, _ := event.GetValue("id") + assert.EqualValues(t, "RS_0", id) + + name, _ := event.GetValue("name") assert.EqualValues(t, name, "resourcepool-test") cpuUsage, _ := event.GetValue("cpu.usage.mhz") diff --git a/metricbeat/module/vsphere/virtualmachine/_meta/data.json b/metricbeat/module/vsphere/virtualmachine/_meta/data.json index 8549f84040a..57ef6e74770 100644 --- a/metricbeat/module/vsphere/virtualmachine/_meta/data.json +++ b/metricbeat/module/vsphere/virtualmachine/_meta/data.json @@ -15,6 +15,7 @@ }, "vsphere": { "virtualmachine": { + "id": "vm-51", "name": "xt0nmfpv9", "uptime": 5348978, "status": "green", diff --git a/metricbeat/module/vsphere/virtualmachine/_meta/fields.yml b/metricbeat/module/vsphere/virtualmachine/_meta/fields.yml index a83013105dc..eb6cc6d88e5 100644 --- a/metricbeat/module/vsphere/virtualmachine/_meta/fields.yml +++ b/metricbeat/module/vsphere/virtualmachine/_meta/fields.yml @@ -15,14 +15,18 @@ type: keyword description: > Hostname of the host. + - name: id + type: keyword + description: > + Unique virtual machine ID. - name: name type: keyword description: > - Virtual Machine name. + Virtual machine name. - name: os type: keyword description: > - Virtual Machine Operating System name. + Virtual machine Operating System name. - name: cpu.used.mhz type: long description: > @@ -38,22 +42,22 @@ - name: memory.used.guest.bytes type: long description: > - Used Memory of Guest in bytes. + Used memory of Guest in bytes. format: bytes - name: memory.used.host.bytes type: long description: > - Used Memory of Host in bytes. + Used memory of Host in bytes. format: bytes - name: memory.total.guest.bytes type: long description: > - Total Memory of Guest in bytes. + Total memory of Guest in bytes. format: bytes - name: memory.free.guest.bytes type: long description: > - Free Memory of Guest in bytes. + Free memory of Guest in bytes. format: bytes - name: custom_fields type: object diff --git a/metricbeat/module/vsphere/virtualmachine/data.go b/metricbeat/module/vsphere/virtualmachine/data.go index a107f11a0d2..0839f5789cc 100644 --- a/metricbeat/module/vsphere/virtualmachine/data.go +++ b/metricbeat/module/vsphere/virtualmachine/data.go @@ -33,6 +33,7 @@ func (m *MetricSet) mapEvent(data VMData) mapstr.M { event := mapstr.M{ "name": data.VM.Summary.Config.Name, + "id": data.VM.Self.Value, "os": data.VM.Summary.Config.GuestFullName, "uptime": data.VM.Summary.QuickStats.UptimeSeconds, "status": data.VM.Summary.OverallStatus, diff --git a/metricbeat/module/vsphere/virtualmachine/data_test.go b/metricbeat/module/vsphere/virtualmachine/data_test.go index 32abe001c39..b1676db8118 100644 --- a/metricbeat/module/vsphere/virtualmachine/data_test.go +++ b/metricbeat/module/vsphere/virtualmachine/data_test.go @@ -32,6 +32,13 @@ func TestEventMapping(t *testing.T) { var m MetricSet VirtualMachineTest := mo.VirtualMachine{ + ManagedEntity: mo.ManagedEntity{ + ExtensibleManagedObject: mo.ExtensibleManagedObject{ + Self: types.ManagedObjectReference{ + Value: "VM_0", + }, + }, + }, Summary: types.VirtualMachineSummary{ OverallStatus: types.ManagedEntityStatus("green"), Config: types.VirtualMachineConfigSummary{ @@ -83,6 +90,7 @@ func TestEventMapping(t *testing.T) { expectedEvent := mapstr.M{ "name": "localhost.localdomain", "os": "otherGuest", + "id": "VM_0", "uptime": int32(10), "status": types.ManagedEntityStatus("green"), "cpu": mapstr.M{