Add systemd information to validate output.
This commit is contained in:
parent
124c08f82a
commit
4ec9894ea2
@ -50,6 +50,11 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func UseSystemd() bool {
|
||||||
|
// init would run and initialize useSystemd before we can call this method.
|
||||||
|
return useSystemd
|
||||||
|
}
|
||||||
|
|
||||||
type dockerFactory struct {
|
type dockerFactory struct {
|
||||||
machineInfoFactory info.MachineInfoFactory
|
machineInfoFactory info.MachineInfoFactory
|
||||||
|
|
||||||
|
@ -23,12 +23,12 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/libcontainer/cgroups"
|
"github.com/docker/libcontainer/cgroups"
|
||||||
dclient "github.com/fsouza/go-dockerclient"
|
dclient "github.com/fsouza/go-dockerclient"
|
||||||
"github.com/google/cadvisor/container/docker"
|
"github.com/google/cadvisor/container/docker"
|
||||||
|
"github.com/google/cadvisor/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
const ValidatePage = "/validate/"
|
const ValidatePage = "/validate/"
|
||||||
@ -163,6 +163,11 @@ func validateDockerInfo() (string, string) {
|
|||||||
execDriver := info.Get("ExecutionDriver")
|
execDriver := info.Get("ExecutionDriver")
|
||||||
storageDriver := info.Get("Driver")
|
storageDriver := info.Get("Driver")
|
||||||
desc := fmt.Sprintf("Docker exec driver is %s. Storage driver is %s.\n", execDriver, storageDriver)
|
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") {
|
if strings.Contains(execDriver, "native") {
|
||||||
return Recommended, desc
|
return Recommended, desc
|
||||||
} else if strings.Contains(execDriver, "lxc") {
|
} else if strings.Contains(execDriver, "lxc") {
|
||||||
@ -184,7 +189,7 @@ func validateCgroupMounts() (string, string) {
|
|||||||
return Unknown, out
|
return Unknown, out
|
||||||
}
|
}
|
||||||
mnt = strings.TrimSuffix(mnt, "/cpu")
|
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 := fmt.Sprintf("Cgroup mount directory %s inaccessible.\n", mnt)
|
||||||
out += desc
|
out += desc
|
||||||
return Unsupported, out
|
return Unsupported, out
|
||||||
|
Loading…
Reference in New Issue
Block a user