Skip to content

Commit

Permalink
Handle missing cgroups in Metricbeat (#3692)
Browse files Browse the repository at this point in the history
Add error handling to system process metricset for when Linux cgroups are missing from the kernel.

Adds fix from elastic/gosigar#64.
Fixes #3666.
  • Loading branch information
andrewkroh authored and tsg committed Feb 28, 2017
1 parent a743ab8 commit b4eb0a7
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ https://github.com/elastic/beats/compare/v5.1.1...master[Check the HEAD diff]
- Fix go routine leak in docker module. {pull}3492[3492]
- Fix bug docker module hanging when docker container killed. {issue}3610[3610]
- Set timeout to period instead of 1s by default as documented.
- Add error handling to system process metricset for when Linux cgroups are missing from the kernel. {pull}3692[3692]

*Packetbeat*

Expand Down
2 changes: 1 addition & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import:
subpackages:
- /difflib
- package: github.com/elastic/gosigar
version: b49e01eb1e5c68c469392a63feaccae9352ceb12
version: v0.2.0
- package: github.com/elastic/procfs
version: abf152e5f3e97f2fafac028d2cc06c1feb87ffa5
- package: github.com/samuel/go-parser
Expand Down
8 changes: 6 additions & 2 deletions metricbeat/module/system/process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,14 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
}

if config.Cgroups == nil || *config.Cgroups {
debugf("process cgroup data collection is enabled")
debugf("process cgroup data collection is enabled, using hostfs='%v'", systemModule.HostFS)
m.cgroup, err = cgroup.NewReader(systemModule.HostFS, true)
if err != nil {
return nil, errors.Wrap(err, "error initializing cgroup reader")
if err == cgroup.ErrCgroupsMissing {
logp.Warn("cgroup data collection will be disabled: %v", err)
} else {
return nil, errors.Wrap(err, "error initializing cgroup reader")
}
}
}
}
Expand Down
24 changes: 20 additions & 4 deletions vendor/github.com/elastic/gosigar/CHANGELOG.md

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

21 changes: 21 additions & 0 deletions vendor/github.com/elastic/gosigar/cgroup/util.go

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

0 comments on commit b4eb0a7

Please sign in to comment.