-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Point to the right cgroup root dir on Amazon Linux #880
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's be a bit more specific on the Stat.
Also, to ease support and debugging, we need to log what root was detected. Could we for example add a log.Warnf here
datadog-agent/pkg/util/docker/cgroup.go
Line 467 in 589e145
return mountPoints |
if we find zero mounts?
pkg/config/config.go
Outdated
@@ -94,7 +94,12 @@ func init() { | |||
|
|||
} else { | |||
Datadog.SetDefault("container_proc_root", "/proc") | |||
Datadog.SetDefault("container_cgroup_root", "/sys/fs/cgroup/") | |||
// for amazon linux the cgroup directory on host is /cgroup/ | |||
if _, err := os.Stat("/cgroup/"); err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's be more specific on the Stat and make sure we don't have an empty folder. We could look for /cgroup/memory/memory.stat
for example
pkg/util/docker/cgroup.go
Outdated
@@ -464,6 +464,7 @@ func parseCgroupMountPoints(r io.Reader) map[string]string { | |||
} | |||
} | |||
} | |||
log.Warnf("current cgroup root is: %s", cgroupRoot) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid log spam, I'd just log if we have an actual warning:
if len(mountPoints) == 0 {
log.Warnf("could not locate cgroup folders in %s, please check your configuration", cgroupRoot)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I immediately realized that, change already made.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, could you please test it on an Amazon Linux host and a debian host before merging?
What does this PR do?
For agents running on amazon linux, the cgroup mount directory is at
/cgroup/
. This PR sets the variablecontainer_cgroup_root
to that as the default value.Motivation
Amazon linux.