Skip to content

Commit

Permalink
Added function to return pretty names on "system" module "process sum…
Browse files Browse the repository at this point in the history
…mary" metricset (elastic#8275)

Added function to return pretty names on "system" module "process summary" metricset
  • Loading branch information
sayden authored Sep 14, 2018
1 parent aad03b4 commit 457a784
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ https://github.com/elastic/beats/compare/v6.4.0...master[Check the HEAD diff]
- Increase ignore_above for system.process.cmdline to 2048. {pull}8101[8100]
- Add support to renamed fields planned for redis 5.0. {pull}8167[8167]
- Allow TCP helper to support delimiters and graphite module to accept multiple metrics in a single payload. {pull}8278[8278]
- Added 'died' PID state to process_system metricset on system module{pull}8275[8275]

*Packetbeat*

Expand Down
10 changes: 10 additions & 0 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -19638,6 +19638,16 @@ type: long
Number of zombie processes on this host.
--
*`system.process.summary.dead`*::
+
--
type: long
Number of dead processes on this host. It's very unlikely that it will appear but in some special situations it may happen.
--
*`system.process.summary.unknown`*::
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/system/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions metricbeat/module/system/process_summary/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
type: long
description: >
Number of zombie processes on this host.
- name: dead
type: long
description: >
Number of dead processes on this host. It's very unlikely that it will appear but in some special situations it may happen.
- name: unknown
type: long
description: >
Expand Down
6 changes: 5 additions & 1 deletion metricbeat/module/system/process_summary/process_summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func (m *MetricSet) Fetch() (common.MapStr, error) {
stopped int
zombie int
unknown int
dead int
}

for _, pid := range pids {
Expand All @@ -95,8 +96,10 @@ func (m *MetricSet) Fetch() (common.MapStr, error) {
summary.stopped++
case 'Z':
summary.zombie++
case 'X':
summary.dead++
default:
logp.Err("Unknown state <%v> for process with pid %d", state.State, pid)
logp.Err("Unknown or unexpected state <%c> for process with pid %d", state.State, pid)
summary.unknown++
}
}
Expand All @@ -109,6 +112,7 @@ func (m *MetricSet) Fetch() (common.MapStr, error) {
"stopped": summary.stopped,
"zombie": summary.zombie,
"unknown": summary.unknown,
"dead": summary.dead,
}
// change the name space to use . instead of _
event[mb.NamespaceKey] = "process.summary"
Expand Down

0 comments on commit 457a784

Please sign in to comment.