Fix Docker handler for machines that use systemd just as a naming service without controlling cgroups.
This commit is contained in:
parent
90e407d234
commit
f585e4bc5e
@ -28,6 +28,7 @@ import (
|
||||
"github.com/golang/glog"
|
||||
"github.com/google/cadvisor/container"
|
||||
"github.com/google/cadvisor/info"
|
||||
"github.com/google/cadvisor/utils"
|
||||
)
|
||||
|
||||
var ArgDockerEndpoint = flag.String("docker", "unix:///var/run/docker.sock", "docker endpoint")
|
||||
@ -45,8 +46,13 @@ func init() {
|
||||
useSystemd = systemd.UseSystemd()
|
||||
if !useSystemd {
|
||||
// Second attempt at checking for systemd, check for a "name=systemd" cgroup.
|
||||
_, err := cgroups.FindCgroupMountpoint("name=systemd")
|
||||
useSystemd = (err == nil)
|
||||
mnt, err := cgroups.FindCgroupMountpoint("cpu")
|
||||
if err == nil {
|
||||
// systemd presence does not mean systemd controls cgroups.
|
||||
// If system.slice cgroup exists, then systemd is taking control.
|
||||
// This breaks if user creates system.slice manually :)
|
||||
useSystemd = utils.FileExists(mnt + "/system.slice")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user