From 0d56a640bd23a961b061d20f65abc5a896f73d51 Mon Sep 17 00:00:00 2001 From: niraj-elastic <124254029+niraj-elastic@users.noreply.github.com> Date: Wed, 18 Sep 2024 16:31:31 +0530 Subject: [PATCH] [vSphere] update field name for triggered_alarm (#40876) * update field name * update changelog * update changelog --------- Co-authored-by: Niraj Rathod --- CHANGELOG.next.asciidoc | 2 +- metricbeat/docs/fields.asciidoc | 28 ++++++------- .../module/vsphere/cluster/_meta/data.json | 2 +- .../module/vsphere/cluster/_meta/fields.yml | 4 +- metricbeat/module/vsphere/cluster/cluster.go | 16 +++---- metricbeat/module/vsphere/cluster/data.go | 4 +- .../module/vsphere/datastore/_meta/fields.yml | 4 +- metricbeat/module/vsphere/datastore/data.go | 4 +- .../module/vsphere/datastore/datastore.go | 22 +++++----- .../vsphere/datastorecluster/_meta/fields.yml | 4 +- .../module/vsphere/datastorecluster/data.go | 4 +- .../datastorecluster/datastorecluster.go | 16 +++---- metricbeat/module/vsphere/fields.go | 2 +- .../module/vsphere/host/_meta/data.json | 2 +- .../module/vsphere/host/_meta/fields.yml | 4 +- metricbeat/module/vsphere/host/data.go | 4 +- metricbeat/module/vsphere/host/host.go | 24 +++++------ .../module/vsphere/network/_meta/fields.yml | 4 +- metricbeat/module/vsphere/network/data.go | 4 +- metricbeat/module/vsphere/network/network.go | 16 +++---- .../vsphere/resourcepool/_meta/fields.yml | 4 +- .../module/vsphere/resourcepool/data.go | 4 +- .../vsphere/resourcepool/resourcepool.go | 16 +++---- .../vsphere/virtualmachine/_meta/fields.yml | 4 +- .../module/vsphere/virtualmachine/data.go | 4 +- .../vsphere/virtualmachine/virtualmachine.go | 42 +++++++++---------- 26 files changed, 122 insertions(+), 122 deletions(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index f699dce71ad..2ab40caf7db 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -336,7 +336,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff] - Add new metrics for the vSphere Virtualmachine metricset. {pull}40485[40485] - Add support for snapshot in vSphere virtualmachine metricset {pull}40683[40683] - Update fields to use mapstr in vSphere virtualmachine metricset {pull}40707[40707] -- Add metrics related to alert in all the vSphere metricsets. {pull}40714[40714] +- Add metrics related to triggered alarms in all the vSphere metricsets. {pull}40714[40714] {pull}40876[40876] - Add support for period based intervalID in vSphere host and datastore metricsets {pull}40678[40678] - Add new metrics fot datastore and minor changes to overall vSphere metrics {pull}40766[40766] - Add `metrics_count` to Prometheus module if `metrics_count: true` is set. {pull}40411[40411] diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index fd021b65fd6..5161641a39d 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -67022,10 +67022,10 @@ type: keyword -- -*`vsphere.cluster.triggerd_alarms.*`*:: +*`vsphere.cluster.triggered_alarms.*`*:: + -- -List of all the triggerd alarms. +List of all the triggered alarms. type: object @@ -67185,10 +67185,10 @@ type: keyword -- -*`vsphere.datastore.triggerd_alarms.*`*:: +*`vsphere.datastore.triggered_alarms.*`*:: + -- -List of all the triggerd alarms. +List of all the triggered alarms. type: object @@ -67288,10 +67288,10 @@ type: long -- -*`vsphere.datastorecluster.triggerd_alarms.*`*:: +*`vsphere.datastorecluster.triggered_alarms.*`*:: + -- -List of all the triggerd alarms. +List of all the triggered alarms. type: object @@ -67655,10 +67655,10 @@ type: keyword -- -*`vsphere.host.triggerd_alarms.*`*:: +*`vsphere.host.triggered_alarms.*`*:: + -- -List of all the triggerd alarms. +List of all the triggered alarms. type: object @@ -67794,10 +67794,10 @@ type: long -- -*`vsphere.network.triggerd_alarms.*`*:: +*`vsphere.network.triggered_alarms.*`*:: + -- -List of all the triggerd alarms. +List of all the triggered alarms. type: object @@ -68030,10 +68030,10 @@ type: keyword -- -*`vsphere.resourcepool.triggerd_alarms.*`*:: +*`vsphere.resourcepool.triggered_alarms.*`*:: + -- -List of all the triggerd alarms. +List of all the triggered alarms. type: object @@ -68267,10 +68267,10 @@ type: long -- -*`vsphere.virtualmachine.triggerd_alarms.*`*:: +*`vsphere.virtualmachine.triggered_alarms.*`*:: + -- -List of all the triggerd alarms. +List of all the triggered alarms. type: object diff --git a/metricbeat/module/vsphere/cluster/_meta/data.json b/metricbeat/module/vsphere/cluster/_meta/data.json index 7c8c435c0d9..d704ceb865a 100644 --- a/metricbeat/module/vsphere/cluster/_meta/data.json +++ b/metricbeat/module/vsphere/cluster/_meta/data.json @@ -15,7 +15,7 @@ }, "vsphere": { "cluster": { - "triggerd_alarms": [ + "triggered_alarms": [ { "status": "red", "triggered_time": "2024-09-09T13:23:00.786Z", diff --git a/metricbeat/module/vsphere/cluster/_meta/fields.yml b/metricbeat/module/vsphere/cluster/_meta/fields.yml index ded927ba59e..27025e92848 100644 --- a/metricbeat/module/vsphere/cluster/_meta/fields.yml +++ b/metricbeat/module/vsphere/cluster/_meta/fields.yml @@ -52,8 +52,8 @@ type: keyword description: > List of all the Network names associated with the cluster. - - name: triggerd_alarms.* + - name: triggered_alarms.* type: object object_type: keyword description: > - List of all the triggerd alarms. \ No newline at end of file + List of all the triggered alarms. \ No newline at end of file diff --git a/metricbeat/module/vsphere/cluster/cluster.go b/metricbeat/module/vsphere/cluster/cluster.go index 21d51f936d7..24f7095c186 100644 --- a/metricbeat/module/vsphere/cluster/cluster.go +++ b/metricbeat/module/vsphere/cluster/cluster.go @@ -55,7 +55,7 @@ type assetNames struct { outputHostNames []string } -type triggerdAlarm struct { +type triggeredAlarm struct { Name string `json:"name"` ID string `json:"id"` Status string `json:"status"` @@ -65,8 +65,8 @@ type triggerdAlarm struct { } type metricData struct { - assetNames assetNames - triggerdAlarms []triggerdAlarm + assetNames assetNames + triggeredAlarms []triggeredAlarm } // New creates a new instance of the MetricSet. @@ -136,13 +136,13 @@ func (m *ClusterMetricSet) Fetch(ctx context.Context, reporter mb.ReporterV2) er m.Logger().Warn("Metric das_config.enabled not found") } - triggerdAlarm, err := getTriggerdAlarm(ctx, pc, clt[i].TriggeredAlarmState) + triggeredAlarm, err := getTriggeredAlarm(ctx, pc, clt[i].TriggeredAlarmState) if err != nil { m.Logger().Errorf("Failed to retrieve alerts from cluster %s: %w", clt[i].Name, err) } reporter.Event(mb.Event{ - MetricSetFields: m.mapEvent(clt[i], &metricData{assetNames: assetNames, triggerdAlarms: triggerdAlarm}), + MetricSetFields: m.mapEvent(clt[i], &metricData{assetNames: assetNames, triggeredAlarms: triggeredAlarm}), }) } } @@ -194,10 +194,10 @@ func getAssetNames(ctx context.Context, pc *property.Collector, cl *mo.ClusterCo }, nil } -func getTriggerdAlarm(ctx context.Context, pc *property.Collector, triggeredAlarmState []types.AlarmState) ([]triggerdAlarm, error) { - var triggeredAlarms []triggerdAlarm +func getTriggeredAlarm(ctx context.Context, pc *property.Collector, triggeredAlarmState []types.AlarmState) ([]triggeredAlarm, error) { + var triggeredAlarms []triggeredAlarm for _, alarmState := range triggeredAlarmState { - var triggeredAlarm triggerdAlarm + var triggeredAlarm triggeredAlarm var alarm mo.Alarm err := pc.RetrieveOne(ctx, alarmState.Alarm, nil, &alarm) if err != nil { diff --git a/metricbeat/module/vsphere/cluster/data.go b/metricbeat/module/vsphere/cluster/data.go index 06cf976499b..a15e48377b5 100644 --- a/metricbeat/module/vsphere/cluster/data.go +++ b/metricbeat/module/vsphere/cluster/data.go @@ -40,8 +40,8 @@ func (m *ClusterMetricSet) mapEvent(cl mo.ClusterComputeResource, data *metricDa "name": cl.Name, } - if len(data.triggerdAlarms) > 0 { - event.Put("triggerd_alarms", data.triggerdAlarms) + if len(data.triggeredAlarms) > 0 { + event.Put("triggered_alarms", data.triggeredAlarms) } if cl.Configuration.DasConfig.Enabled != nil { diff --git a/metricbeat/module/vsphere/datastore/_meta/fields.yml b/metricbeat/module/vsphere/datastore/_meta/fields.yml index 18c4bc3846a..a9b9352f67f 100644 --- a/metricbeat/module/vsphere/datastore/_meta/fields.yml +++ b/metricbeat/module/vsphere/datastore/_meta/fields.yml @@ -64,11 +64,11 @@ type: keyword description: > Status of the datastore. - - name: triggerd_alarms.* + - name: triggered_alarms.* type: object object_type: keyword description: > - List of all the triggerd alarms. + List of all the triggered alarms. - name: vm.count type: long description: > diff --git a/metricbeat/module/vsphere/datastore/data.go b/metricbeat/module/vsphere/datastore/data.go index c4a2c5e28f5..1950d32a474 100644 --- a/metricbeat/module/vsphere/datastore/data.go +++ b/metricbeat/module/vsphere/datastore/data.go @@ -49,8 +49,8 @@ func (m *DataStoreMetricSet) mapEvent(ds mo.Datastore, data *metricData) mapstr. }, } - if len(data.triggerdAlarms) > 0 { - event.Put("triggerd_alarms", data.triggerdAlarms) + if len(data.triggeredAlarms) > 0 { + event.Put("triggered_alarms", data.triggeredAlarms) } if ds.Summary.Capacity > 0 { diff --git a/metricbeat/module/vsphere/datastore/datastore.go b/metricbeat/module/vsphere/datastore/datastore.go index 4a0f40df93d..a7359d20e5b 100644 --- a/metricbeat/module/vsphere/datastore/datastore.go +++ b/metricbeat/module/vsphere/datastore/datastore.go @@ -55,7 +55,7 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { return &DataStoreMetricSet{ms}, nil } -type triggerdAlarm struct { +type triggeredAlarm struct { Name string `json:"name"` ID string `json:"id"` Status string `json:"status"` @@ -65,9 +65,9 @@ type triggerdAlarm struct { } type metricData struct { - perfMetrics map[string]interface{} - assetNames assetNames - triggerdAlarms []triggerdAlarm + perfMetrics map[string]interface{} + assetNames assetNames + triggeredAlarms []triggeredAlarm } type assetNames struct { @@ -149,16 +149,16 @@ func (m *DataStoreMetricSet) Fetch(ctx context.Context, reporter mb.ReporterV2) m.Logger().Errorf("Failed to retrieve performance metrics from datastore %s: %v", dst[i].Name, err) } - triggerdAlarm, err := getTriggerdAlarm(ctx, pc, dst[i].TriggeredAlarmState) + triggeredAlarm, err := getTriggeredAlarm(ctx, pc, dst[i].TriggeredAlarmState) if err != nil { m.Logger().Errorf("Failed to retrieve alerts from datastore %s: %w", dst[i].Name, err) } reporter.Event(mb.Event{ MetricSetFields: m.mapEvent(dst[i], &metricData{ - perfMetrics: metricMap, - triggerdAlarms: triggerdAlarm, - assetNames: assetNames, + perfMetrics: metricMap, + triggeredAlarms: triggeredAlarm, + assetNames: assetNames, }), }) } @@ -213,10 +213,10 @@ func getAssetNames(ctx context.Context, pc *property.Collector, ds *mo.Datastore }, nil } -func getTriggerdAlarm(ctx context.Context, pc *property.Collector, triggeredAlarmState []types.AlarmState) ([]triggerdAlarm, error) { - var triggeredAlarms []triggerdAlarm +func getTriggeredAlarm(ctx context.Context, pc *property.Collector, triggeredAlarmState []types.AlarmState) ([]triggeredAlarm, error) { + var triggeredAlarms []triggeredAlarm for _, alarmState := range triggeredAlarmState { - var triggeredAlarm triggerdAlarm + var triggeredAlarm triggeredAlarm var alarm mo.Alarm err := pc.RetrieveOne(ctx, alarmState.Alarm, nil, &alarm) if err != nil { diff --git a/metricbeat/module/vsphere/datastorecluster/_meta/fields.yml b/metricbeat/module/vsphere/datastorecluster/_meta/fields.yml index 43939b60691..9fcceb295ad 100644 --- a/metricbeat/module/vsphere/datastorecluster/_meta/fields.yml +++ b/metricbeat/module/vsphere/datastorecluster/_meta/fields.yml @@ -26,8 +26,8 @@ type: long description: > Number of datastores in the Datastore Cluster. - - name: triggerd_alarms.* + - name: triggered_alarms.* type: object object_type: keyword description: > - List of all the triggerd alarms. \ No newline at end of file + List of all the triggered alarms. \ No newline at end of file diff --git a/metricbeat/module/vsphere/datastorecluster/data.go b/metricbeat/module/vsphere/datastorecluster/data.go index fc727a6d01a..3dcce129e56 100644 --- a/metricbeat/module/vsphere/datastorecluster/data.go +++ b/metricbeat/module/vsphere/datastorecluster/data.go @@ -38,8 +38,8 @@ func (m *DatastoreClusterMetricSet) mapEvent(datastoreCluster mo.StoragePod, dat }, } - if len(data.triggerdAlarms) > 0 { - event.Put("triggerd_alarms", data.triggerdAlarms) + if len(data.triggeredAlarms) > 0 { + event.Put("triggered_alarms", data.triggeredAlarms) } return event diff --git a/metricbeat/module/vsphere/datastorecluster/datastorecluster.go b/metricbeat/module/vsphere/datastorecluster/datastorecluster.go index 762888d06f0..3a24b4c1aaf 100644 --- a/metricbeat/module/vsphere/datastorecluster/datastorecluster.go +++ b/metricbeat/module/vsphere/datastorecluster/datastorecluster.go @@ -60,11 +60,11 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { } type metricData struct { - assetNames assetNames - triggerdAlarms []triggerdAlarm + assetNames assetNames + triggeredAlarms []triggeredAlarm } -type triggerdAlarm struct { +type triggeredAlarm struct { Name string `json:"name"` ID string `json:"id"` Status string `json:"status"` @@ -122,12 +122,12 @@ func (m *DatastoreClusterMetricSet) Fetch(ctx context.Context, reporter mb.Repor m.Logger().Errorf("Failed to retrieve object from datastore cluster %s: v", datastoreCluster[i].Name, err) } - triggerdAlarm, err := getTriggerdAlarm(ctx, pc, datastoreCluster[i].TriggeredAlarmState) + triggeredAlarm, err := getTriggeredAlarm(ctx, pc, datastoreCluster[i].TriggeredAlarmState) if err != nil { m.Logger().Errorf("Failed to retrieve alerts from datastore cluster %s: %w", datastoreCluster[i].Name, err) } - reporter.Event(mb.Event{MetricSetFields: m.mapEvent(datastoreCluster[i], &metricData{assetNames: assetNames, triggerdAlarms: triggerdAlarm})}) + reporter.Event(mb.Event{MetricSetFields: m.mapEvent(datastoreCluster[i], &metricData{assetNames: assetNames, triggeredAlarms: triggeredAlarm})}) } return nil @@ -154,10 +154,10 @@ func getAssetNames(ctx context.Context, pc *property.Collector, dsc *mo.StorageP }, nil } -func getTriggerdAlarm(ctx context.Context, pc *property.Collector, triggeredAlarmState []types.AlarmState) ([]triggerdAlarm, error) { - var triggeredAlarms []triggerdAlarm +func getTriggeredAlarm(ctx context.Context, pc *property.Collector, triggeredAlarmState []types.AlarmState) ([]triggeredAlarm, error) { + var triggeredAlarms []triggeredAlarm for _, alarmState := range triggeredAlarmState { - var triggeredAlarm triggerdAlarm + var triggeredAlarm triggeredAlarm var alarm mo.Alarm err := pc.RetrieveOne(ctx, alarmState.Alarm, nil, &alarm) if err != nil { diff --git a/metricbeat/module/vsphere/fields.go b/metricbeat/module/vsphere/fields.go index 09f24acb349..7e3988627f8 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/XpJNXFKgzs/hnp47U8r/EjgUevny9wnCOeanAQAmmVTF05eZuKxqg3LXIYeVTfYbKBIY5Mm53i5UmWix3tqXwXmM8IZXfNBH4BZ1snFxqxMcWF4qbe2iTb8G0yqKIivPZrRgfaGEoiYrzb0PJRDDzllMEkIahoOR1JRQeP3AC7F+kGUmLa3Jga6A1XfB0e2Dn4cfdZRM3b4safUz5PvhirNCUgOE/KIKQD7EWBtdxPew5JcDM5RAH1oF08q5FzAqtSVqxgyVxuXbFmCkyb0RXc5VrteGuxIts5J9b7BiygIYn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O7gQubE1/RSme/ovWdDOnNmRAi39X6vEEucCnoJPHmsHp/YyvGyLpalf2sOJP1vc2qSFjLq4lRLinEF+zBVYV4kvVmGB9t895HBLCsMFZlryGlzJm4HzzhMpe9txsPN/USyoPz2/1dzsad7upM9LBg+ZkHuEnnGyjPwTnVO+3mUpDseLPd+9PPWJRT7SH/PNw/okwO9pBnHYpFHzDcjxaWY3v70cIeqUjMTaoiVvpypVr7LRgO3XBe+G7J4AtZ5KK244oXU7+7Yz7r9U2N2lYvQ3Ir29b/BwAA//+me5hU" } diff --git a/metricbeat/module/vsphere/host/_meta/data.json b/metricbeat/module/vsphere/host/_meta/data.json index 26ffcbffee2..0034692e95b 100644 --- a/metricbeat/module/vsphere/host/_meta/data.json +++ b/metricbeat/module/vsphere/host/_meta/data.json @@ -15,7 +15,7 @@ }, "vsphere": { "host": { - "triggerd_alarms": [ + "triggered_alarms": [ { "status": "red", "triggered_time": "2024-09-09T13:23:00.786Z", diff --git a/metricbeat/module/vsphere/host/_meta/fields.yml b/metricbeat/module/vsphere/host/_meta/fields.yml index 584a907a850..e466ef19e2a 100644 --- a/metricbeat/module/vsphere/host/_meta/fields.yml +++ b/metricbeat/module/vsphere/host/_meta/fields.yml @@ -146,11 +146,11 @@ type: keyword description: > The overall health status of a host in the vSphere environment. - - name: triggerd_alarms.* + - name: triggered_alarms.* type: object object_type: keyword description: > - List of all the triggerd alarms. + List of all the triggered alarms. - name: uptime type: long description: > diff --git a/metricbeat/module/vsphere/host/data.go b/metricbeat/module/vsphere/host/data.go index 45d9a69d2ee..d877ac78af8 100644 --- a/metricbeat/module/vsphere/host/data.go +++ b/metricbeat/module/vsphere/host/data.go @@ -46,8 +46,8 @@ func (m *HostMetricSet) mapEvent(hs mo.HostSystem, data *metricData) mapstr.M { m.Logger().Debug("'Hardware' or 'Summary' data not found. This is either a parsing error from vsphere library, an error trying to reach host/guest or incomplete information returned from host/guest") } - if len(data.triggerdAlarms) > 0 { - event.Put("triggerd_alarms", data.triggerdAlarms) + if len(data.triggeredAlarms) > 0 { + event.Put("triggered_alarms", data.triggeredAlarms) } if len(data.assetNames.outputVmNames) > 0 { diff --git a/metricbeat/module/vsphere/host/host.go b/metricbeat/module/vsphere/host/host.go index 6061b9145e9..59846ae4b2a 100644 --- a/metricbeat/module/vsphere/host/host.go +++ b/metricbeat/module/vsphere/host/host.go @@ -55,7 +55,7 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { return &HostMetricSet{ms}, nil } -type triggerdAlarm struct { +type triggeredAlarm struct { Name string `json:"name"` ID string `json:"id"` Status string `json:"status"` @@ -65,9 +65,9 @@ type triggerdAlarm struct { } type metricData struct { - perfMetrics map[string]interface{} - assetNames assetNames - triggerdAlarms []triggerdAlarm + perfMetrics map[string]interface{} + assetNames assetNames + triggeredAlarms []triggeredAlarm } type assetNames struct { @@ -162,16 +162,16 @@ func (m *HostMetricSet) Fetch(ctx context.Context, reporter mb.ReporterV2) error m.Logger().Errorf("Failed to retrieve performance metrics from host %s: %v", hst[i].Name, err) } - triggerdAlarm, err := getTriggerdAlarm(ctx, pc, hst[i].TriggeredAlarmState) + triggeredAlarm, err := getTriggeredAlarm(ctx, pc, hst[i].TriggeredAlarmState) if err != nil { - m.Logger().Errorf("Failed to retrieve triggerd alarms from host %s: %w", hst[i].Name, err) + m.Logger().Errorf("Failed to retrieve triggered alarms from host %s: %w", hst[i].Name, err) } reporter.Event(mb.Event{ MetricSetFields: m.mapEvent(hst[i], &metricData{ - perfMetrics: metricMap, - triggerdAlarms: triggerdAlarm, - assetNames: assetNames, + perfMetrics: metricMap, + triggeredAlarms: triggeredAlarm, + assetNames: assetNames, }), }) } @@ -221,10 +221,10 @@ func getAssetNames(ctx context.Context, pc *property.Collector, hs *mo.HostSyste }, nil } -func getTriggerdAlarm(ctx context.Context, pc *property.Collector, triggeredAlarmState []types.AlarmState) ([]triggerdAlarm, error) { - var triggeredAlarms []triggerdAlarm +func getTriggeredAlarm(ctx context.Context, pc *property.Collector, triggeredAlarmState []types.AlarmState) ([]triggeredAlarm, error) { + var triggeredAlarms []triggeredAlarm for _, alarmState := range triggeredAlarmState { - var triggeredAlarm triggerdAlarm + var triggeredAlarm triggeredAlarm var alarm mo.Alarm err := pc.RetrieveOne(ctx, alarmState.Alarm, nil, &alarm) if err != nil { diff --git a/metricbeat/module/vsphere/network/_meta/fields.yml b/metricbeat/module/vsphere/network/_meta/fields.yml index 8cc2288ea01..66373f8b188 100644 --- a/metricbeat/module/vsphere/network/_meta/fields.yml +++ b/metricbeat/module/vsphere/network/_meta/fields.yml @@ -46,8 +46,8 @@ type: long description: > Number of virtual machines connected to this network. - - name: triggerd_alarms.* + - name: triggered_alarms.* type: object object_type: keyword description: > - List of all the triggerd alarms. \ No newline at end of file + List of all the triggered alarms. \ No newline at end of file diff --git a/metricbeat/module/vsphere/network/data.go b/metricbeat/module/vsphere/network/data.go index d9db174db77..7f3605d25ab 100644 --- a/metricbeat/module/vsphere/network/data.go +++ b/metricbeat/module/vsphere/network/data.go @@ -32,8 +32,8 @@ func (m *NetworkMetricSet) mapEvent(net mo.Network, data *metricData) mapstr.M { event.Put("config.status", net.ConfigStatus) event.Put("type", net.Self.Type) - if len(data.triggerdAlarms) > 0 { - event.Put("triggerd_alarms", data.triggerdAlarms) + if len(data.triggeredAlarms) > 0 { + event.Put("triggered_alarms", data.triggeredAlarms) } if len(data.assetNames.outputHostNames) > 0 { diff --git a/metricbeat/module/vsphere/network/network.go b/metricbeat/module/vsphere/network/network.go index d5cded4d433..e5518da6eed 100644 --- a/metricbeat/module/vsphere/network/network.go +++ b/metricbeat/module/vsphere/network/network.go @@ -58,7 +58,7 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { return &NetworkMetricSet{ms}, nil } -type triggerdAlarm struct { +type triggeredAlarm struct { Name string `json:"name"` ID string `json:"id"` Status string `json:"status"` @@ -68,8 +68,8 @@ type triggerdAlarm struct { } type metricData struct { - assetNames assetNames - triggerdAlarms []triggerdAlarm + assetNames assetNames + triggeredAlarms []triggeredAlarm } type assetNames struct { @@ -127,13 +127,13 @@ func (m *NetworkMetricSet) Fetch(ctx context.Context, reporter mb.ReporterV2) er continue } - triggerdAlarm, err := getTriggerdAlarm(ctx, pc, networks[i].TriggeredAlarmState) + triggeredAlarm, err := getTriggeredAlarm(ctx, pc, networks[i].TriggeredAlarmState) if err != nil { m.Logger().Errorf("Failed to retrieve alerts from network %s: %w", networks[i].Name, err) } reporter.Event(mb.Event{ - MetricSetFields: m.mapEvent(networks[i], &metricData{assetNames: assetNames, triggerdAlarms: triggerdAlarm}), + MetricSetFields: m.mapEvent(networks[i], &metricData{assetNames: assetNames, triggeredAlarms: triggeredAlarm}), }) } } @@ -172,10 +172,10 @@ func getAssetNames(ctx context.Context, pc *property.Collector, net *mo.Network) }, nil } -func getTriggerdAlarm(ctx context.Context, pc *property.Collector, triggeredAlarmState []types.AlarmState) ([]triggerdAlarm, error) { - var triggeredAlarms []triggerdAlarm +func getTriggeredAlarm(ctx context.Context, pc *property.Collector, triggeredAlarmState []types.AlarmState) ([]triggeredAlarm, error) { + var triggeredAlarms []triggeredAlarm for _, alarmState := range triggeredAlarmState { - var triggeredAlarm triggerdAlarm + var triggeredAlarm triggeredAlarm var alarm mo.Alarm err := pc.RetrieveOne(ctx, alarmState.Alarm, nil, &alarm) if err != nil { diff --git a/metricbeat/module/vsphere/resourcepool/_meta/fields.yml b/metricbeat/module/vsphere/resourcepool/_meta/fields.yml index 788a974a7fd..2df15df42e1 100644 --- a/metricbeat/module/vsphere/resourcepool/_meta/fields.yml +++ b/metricbeat/module/vsphere/resourcepool/_meta/fields.yml @@ -112,8 +112,8 @@ type: keyword description: > Names of virtual machines on the resource pool. - - name: triggerd_alarms.* + - name: triggered_alarms.* type: object object_type: keyword description: > - List of all the triggerd alarms. + List of all the triggered alarms. diff --git a/metricbeat/module/vsphere/resourcepool/data.go b/metricbeat/module/vsphere/resourcepool/data.go index aa391a3b10c..839e2669c69 100644 --- a/metricbeat/module/vsphere/resourcepool/data.go +++ b/metricbeat/module/vsphere/resourcepool/data.go @@ -60,8 +60,8 @@ func (m *ResourcePoolMetricSet) mapEvent(rp mo.ResourcePool, data *metricData) m event.Put("vm.count", len(data.assetNames.outputVmNames)) } - if len(data.triggerdAlarms) > 0 { - event.Put("triggerd_alarms", data.triggerdAlarms) + if len(data.triggeredAlarms) > 0 { + event.Put("triggered_alarms", data.triggeredAlarms) } return event diff --git a/metricbeat/module/vsphere/resourcepool/resourcepool.go b/metricbeat/module/vsphere/resourcepool/resourcepool.go index c512f07c703..7d0f44156d8 100644 --- a/metricbeat/module/vsphere/resourcepool/resourcepool.go +++ b/metricbeat/module/vsphere/resourcepool/resourcepool.go @@ -60,7 +60,7 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { } // metricData holds performance metrics values. -type triggerdAlarm struct { +type triggeredAlarm struct { Name string `json:"name"` ID string `json:"id"` Status string `json:"status"` @@ -70,8 +70,8 @@ type triggerdAlarm struct { } type metricData struct { - assetNames assetNames - triggerdAlarms []triggerdAlarm + assetNames assetNames + triggeredAlarms []triggeredAlarm } type assetNames struct { @@ -130,13 +130,13 @@ func (m *ResourcePoolMetricSet) Fetch(ctx context.Context, reporter mb.ReporterV m.Logger().Errorf("Failed to retrieve object from resource pool %s: %v", rps[i].Name, err) } - triggerdAlarm, err := getTriggerdAlarm(ctx, pc, rps[i].TriggeredAlarmState) + triggeredAlarm, err := getTriggeredAlarm(ctx, pc, rps[i].TriggeredAlarmState) if err != nil { m.Logger().Errorf("Failed to retrieve alerts from resource pool %s: %w", rps[i].Name, err) } reporter.Event(mb.Event{ - MetricSetFields: m.mapEvent(rps[i], &metricData{assetNames: assetNames, triggerdAlarms: triggerdAlarm}), + MetricSetFields: m.mapEvent(rps[i], &metricData{assetNames: assetNames, triggeredAlarms: triggeredAlarm}), }) } } @@ -166,10 +166,10 @@ func getAssetNames(ctx context.Context, pc *property.Collector, rp *mo.ResourceP return assetNames{outputVmNames: outputVmNames}, nil } -func getTriggerdAlarm(ctx context.Context, pc *property.Collector, triggeredAlarmState []types.AlarmState) ([]triggerdAlarm, error) { - var triggeredAlarms []triggerdAlarm +func getTriggeredAlarm(ctx context.Context, pc *property.Collector, triggeredAlarmState []types.AlarmState) ([]triggeredAlarm, error) { + var triggeredAlarms []triggeredAlarm for _, alarmState := range triggeredAlarmState { - var triggeredAlarm triggerdAlarm + var triggeredAlarm triggeredAlarm var alarm mo.Alarm err := pc.RetrieveOne(ctx, alarmState.Alarm, nil, &alarm) if err != nil { diff --git a/metricbeat/module/vsphere/virtualmachine/_meta/fields.yml b/metricbeat/module/vsphere/virtualmachine/_meta/fields.yml index ab6ff7600e5..a83013105dc 100644 --- a/metricbeat/module/vsphere/virtualmachine/_meta/fields.yml +++ b/metricbeat/module/vsphere/virtualmachine/_meta/fields.yml @@ -104,8 +104,8 @@ - name: count type: long description: The number of snapshots of this virtualmachine. - - name: triggerd_alarms.* + - name: triggered_alarms.* type: object object_type: keyword description: > - List of all the triggerd alarms. + List of all the triggered alarms. diff --git a/metricbeat/module/vsphere/virtualmachine/data.go b/metricbeat/module/vsphere/virtualmachine/data.go index 62d2866d8bb..a107f11a0d2 100644 --- a/metricbeat/module/vsphere/virtualmachine/data.go +++ b/metricbeat/module/vsphere/virtualmachine/data.go @@ -74,8 +74,8 @@ func (m *MetricSet) mapEvent(data VMData) mapstr.M { event.Put("snapshot.count", len(data.Snapshots)) event.Put("snapshot.info", data.Snapshots) } - if len(data.triggerdAlarms) > 0 { - event.Put("triggerd_alarms", data.triggerdAlarms) + if len(data.triggeredAlarms) > 0 { + event.Put("triggered_alarms", data.triggeredAlarms) } return event diff --git a/metricbeat/module/vsphere/virtualmachine/virtualmachine.go b/metricbeat/module/vsphere/virtualmachine/virtualmachine.go index 811597b9934..437f75fe207 100644 --- a/metricbeat/module/vsphere/virtualmachine/virtualmachine.go +++ b/metricbeat/module/vsphere/virtualmachine/virtualmachine.go @@ -50,7 +50,7 @@ type MetricSet struct { GetCustomFields bool } -type triggerdAlarm struct { +type triggeredAlarm struct { Name string `json:"name"` ID string `json:"id"` Status string `json:"status"` @@ -60,14 +60,14 @@ type triggerdAlarm struct { } type VMData struct { - VM mo.VirtualMachine - HostID string - HostName string - NetworkNames []string - DatastoreNames []string - CustomFields mapstr.M - Snapshots []VMSnapshotData - triggerdAlarms []triggerdAlarm + VM mo.VirtualMachine + HostID string + HostName string + NetworkNames []string + DatastoreNames []string + CustomFields mapstr.M + Snapshots []VMSnapshotData + triggeredAlarms []triggeredAlarm } type VMSnapshotData struct { @@ -204,20 +204,20 @@ func (m *MetricSet) Fetch(ctx context.Context, reporter mb.ReporterV2) error { snapshots = fetchSnapshots(vm.Snapshot.RootSnapshotList) } - triggerdAlarm, err := getTriggerdAlarm(ctx, pc, vm.TriggeredAlarmState) + triggeredAlarm, err := getTriggeredAlarm(ctx, pc, vm.TriggeredAlarmState) if err != nil { m.Logger().Errorf("Failed to retrieve alerts from VM %s: %w", vm.Name, err) } data := VMData{ - VM: vm, - HostID: hostID, - HostName: hostName, - NetworkNames: networkNames, - DatastoreNames: datastoreNames, - CustomFields: customFields, - Snapshots: snapshots, - triggerdAlarms: triggerdAlarm, + VM: vm, + HostID: hostID, + HostName: hostName, + NetworkNames: networkNames, + DatastoreNames: datastoreNames, + CustomFields: customFields, + Snapshots: snapshots, + triggeredAlarms: triggeredAlarm, } reporter.Event(mb.Event{ @@ -322,10 +322,10 @@ func fetchSnapshots(snapshotTree []types.VirtualMachineSnapshotTree) []VMSnapsho return snapshots } -func getTriggerdAlarm(ctx context.Context, pc *property.Collector, triggeredAlarmState []types.AlarmState) ([]triggerdAlarm, error) { - var triggeredAlarms []triggerdAlarm +func getTriggeredAlarm(ctx context.Context, pc *property.Collector, triggeredAlarmState []types.AlarmState) ([]triggeredAlarm, error) { + var triggeredAlarms []triggeredAlarm for _, alarmState := range triggeredAlarmState { - var triggeredAlarm triggerdAlarm + var triggeredAlarm triggeredAlarm var alarm mo.Alarm err := pc.RetrieveOne(ctx, alarmState.Alarm, nil, &alarm) if err != nil {