diff --git a/container/raw/factory.go b/container/raw/factory.go index cd913d28..d843bc8f 100644 --- a/container/raw/factory.go +++ b/container/raw/factory.go @@ -30,6 +30,7 @@ import ( ) var dockerOnly = flag.Bool("docker_only", false, "Only report docker containers in addition to root stats") +var disableRootCgroupStats = flag.Bool("disable_root_cgroup_stats", false, "Disable collecting root Cgroup stats") type rawFactory struct { // Factory for machine information. diff --git a/container/raw/handler.go b/container/raw/handler.go index b80f8d2d..ea7ec486 100644 --- a/container/raw/handler.go +++ b/container/raw/handler.go @@ -227,6 +227,9 @@ func (self *rawContainerHandler) getFsStats(stats *info.ContainerStats) error { } func (self *rawContainerHandler) GetStats() (*info.ContainerStats, error) { + if *disableRootCgroupStats && isRootCgroup(self.name) { + return nil, nil + } stats, err := self.libcontainerHandler.GetStats() if err != nil { return stats, err