Make cpu load reader flag controlled.
This commit is contained in:
parent
6c284efb09
commit
64b105db5a
@ -41,6 +41,7 @@ import (
|
|||||||
|
|
||||||
var globalHousekeepingInterval = flag.Duration("global_housekeeping_interval", 1*time.Minute, "Interval between global housekeepings")
|
var globalHousekeepingInterval = flag.Duration("global_housekeeping_interval", 1*time.Minute, "Interval between global housekeepings")
|
||||||
var logCadvisorUsage = flag.Bool("log_cadvisor_usage", false, "Whether to log the usage of the cAdvisor container")
|
var logCadvisorUsage = flag.Bool("log_cadvisor_usage", false, "Whether to log the usage of the cAdvisor container")
|
||||||
|
var enableLoadReader = flag.Bool("enable_load_reader", false, "Whether to enable cpu load reader")
|
||||||
|
|
||||||
// The Manager interface defines operations for starting a manager and getting
|
// The Manager interface defines operations for starting a manager and getting
|
||||||
// container and machine information.
|
// container and machine information.
|
||||||
@ -176,22 +177,24 @@ type manager struct {
|
|||||||
// Start the container manager.
|
// Start the container manager.
|
||||||
func (self *manager) Start() error {
|
func (self *manager) Start() error {
|
||||||
|
|
||||||
// Create cpu load reader.
|
if *enableLoadReader {
|
||||||
cpuLoadReader, err := cpuload.New()
|
// Create cpu load reader.
|
||||||
if err != nil {
|
cpuLoadReader, err := cpuload.New()
|
||||||
// TODO(rjnagal): Promote to warning once we support cpu load inside namespaces.
|
|
||||||
glog.Infof("Could not initialize cpu load reader: %s", err)
|
|
||||||
} else {
|
|
||||||
err = cpuLoadReader.Start()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Warning("Could not start cpu load stat collector: %s", err)
|
// TODO(rjnagal): Promote to warning once we support cpu load inside namespaces.
|
||||||
|
glog.Infof("Could not initialize cpu load reader: %s", err)
|
||||||
} else {
|
} else {
|
||||||
self.loadReader = cpuLoadReader
|
err = cpuLoadReader.Start()
|
||||||
|
if err != nil {
|
||||||
|
glog.Warning("Could not start cpu load stat collector: %s", err)
|
||||||
|
} else {
|
||||||
|
self.loadReader = cpuLoadReader
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Watch for OOMs.
|
// Watch for OOMs.
|
||||||
err = self.watchForNewOoms()
|
err := self.watchForNewOoms()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Failed to start OOM watcher, will not get OOM events: %v", err)
|
glog.Errorf("Failed to start OOM watcher, will not get OOM events: %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user