Skip to content

[Metricbeat] windows.perfmon - No error, but error.message added to event #38401

@tammytorbert

Description

@tammytorbert

Bug - error.message populated, but no error generated by perfmon query.

For confirmed bugs, please report:

Configure Windows Integration with perfmon query like the following:

- object: 'Process'
  instance: ["*"]
  counters:
   - name: '% Processor Time'
     field: cpu_perc
     format: "float"
- object: 'Memory'
  counters: 
   - name: 'Available MBytes'
     field: memory_available_mbytes
     format: "float"
   - name: 'Pages/sec'
     field: memory_pages_sec
     format: "float"

On collection, following will be captured in the error.message field:
failed on query=\\TT-WINHOST1\Memory\Pages/sec: %!w(<nil>)

In discussion with @andrewkroh - mentioned the error should be conditional.

diff --git a/metricbeat/module/windows/perfmon/data.go b/metricbeat/module/windows/perfmon/data.go
index 9add5c0389..f5747888d7 100644
--- a/metricbeat/module/windows/perfmon/data.go
+++ b/metricbeat/module/windows/perfmon/data.go
@@ -69,7 +69,9 @@ func (re *Reader) groupToEvents(counters map[string][]pdh.CounterValue) []mb.Eve
 			if _, ok := eventMap[eventKey]; !ok {
 				eventMap[eventKey] = &mb.Event{
 					MetricSetFields: mapstr.M{},
-					Error:           fmt.Errorf("failed on query=%v: %w", counterPath, val.Err.Error),
+				}
+				if val.Err.Error != nil {
+					eventMap[eventKey].Error = fmt.Errorf("failed on query=%v: %w", counterPath, val.Err.Error)
 				}
 				if val.Instance != "" {
 					// will ignore instance index

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions