Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tammytorbert opened this issue Mar 18, 2024 · 4 comments
Closed
Labels
bug Metricbeat Metricbeat Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team :Windows

Comments

@tammytorbert
Copy link

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
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Mar 18, 2024
@andrewkroh andrewkroh added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Mar 19, 2024
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Mar 19, 2024
@andrewkroh andrewkroh added Metricbeat Metricbeat needs_team Indicates that the issue/PR needs a Team:* label labels Mar 19, 2024
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Mar 19, 2024
@andrewkroh andrewkroh added :Windows needs_team Indicates that the issue/PR needs a Team:* label labels Mar 19, 2024
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Mar 19, 2024
@botelastic
Copy link

botelastic bot commented Mar 19, 2024

This issue doesn't have a Team:<team> label.

@andrewkroh andrewkroh changed the title Windows Integration - Perfmon - No error, but error added to event [Metricbeat] windows.perfmon - No error, but error.message added to event Mar 19, 2024
@cmacknz
Copy link
Member

cmacknz commented Mar 19, 2024

Thanks, also reported in #38140

@cmacknz
Copy link
Member

cmacknz commented Mar 19, 2024

Closing as a duplicate.

@cmacknz cmacknz closed this as not planned Won't fix, can't repro, duplicate, stale Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Metricbeat Metricbeat Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team :Windows
Projects
None yet
Development

No branches or pull requests

4 participants