diff --git a/container/docker/factory.go b/container/docker/factory.go index cc9cdba6..383d32b5 100644 --- a/container/docker/factory.go +++ b/container/docker/factory.go @@ -56,6 +56,11 @@ func init() { } } +func UseSystemd() bool { + // init would run and initialize useSystemd before we can call this method. + return useSystemd +} + type dockerFactory struct { machineInfoFactory info.MachineInfoFactory diff --git a/validate/validate.go b/validate/validate.go index 0c36f5ed..9c52b04e 100644 --- a/validate/validate.go +++ b/validate/validate.go @@ -23,12 +23,12 @@ import ( "io/ioutil" "log" "net/http" - "os" "strings" "github.com/docker/libcontainer/cgroups" dclient "github.com/fsouza/go-dockerclient" "github.com/google/cadvisor/container/docker" + "github.com/google/cadvisor/utils" ) const ValidatePage = "/validate/" @@ -163,6 +163,11 @@ func validateDockerInfo() (string, string) { execDriver := info.Get("ExecutionDriver") storageDriver := info.Get("Driver") desc := fmt.Sprintf("Docker exec driver is %s. Storage driver is %s.\n", execDriver, storageDriver) + if docker.UseSystemd() { + desc += "\tsystemd is being used to create cgroups.\n" + } else { + desc += "\tCgroups are being created through cgroup filesystem.\n" + } if strings.Contains(execDriver, "native") { return Recommended, desc } else if strings.Contains(execDriver, "lxc") { @@ -184,7 +189,7 @@ func validateCgroupMounts() (string, string) { return Unknown, out } mnt = strings.TrimSuffix(mnt, "/cpu") - if _, err := os.Stat(mnt); err != nil { + if !utils.FileExists(mnt) { out := fmt.Sprintf("Cgroup mount directory %s inaccessible.\n", mnt) out += desc return Unsupported, out