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

Point to the right cgroup root dir on Amazon Linux #880

Merged
merged 5 commits into from
Nov 30, 2017

Conversation

shang-wang
Copy link
Contributor

What does this PR do?

For agents running on amazon linux, the cgroup mount directory is at /cgroup/. This PR sets the variable container_cgroup_root to that as the default value.

Motivation

Amazon linux.

@bits-bot
Copy link
Collaborator

bits-bot commented Nov 29, 2017

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@xvello xvello left a 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

return mountPoints

if we find zero mounts?

@@ -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 {
Copy link
Contributor

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

@masci masci changed the title Shang/cgroup root Point to the right cgroup root dir on Amazon Linux Nov 30, 2017
@shang-wang shang-wang requested a review from a team November 30, 2017 15:00
@shang-wang shang-wang requested a review from a team as a code owner November 30, 2017 15:00
@@ -464,6 +464,7 @@ func parseCgroupMountPoints(r io.Reader) map[string]string {
}
}
}
log.Warnf("current cgroup root is: %s", cgroupRoot)
Copy link
Contributor

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)
}

Copy link
Contributor Author

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.

Copy link
Contributor

@xvello xvello left a 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants