Make cpu load reader flag controlled.

This commit is contained in:
Rohit Jnagal 2015-04-15 23:36:13 +00:00
parent 6c284efb09
commit 64b105db5a

View File

@ -41,6 +41,7 @@ import (
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 enableLoadReader = flag.Bool("enable_load_reader", false, "Whether to enable cpu load reader")
// The Manager interface defines operations for starting a manager and getting
// container and machine information.
@ -176,6 +177,7 @@ type manager struct {
// Start the container manager.
func (self *manager) Start() error {
if *enableLoadReader {
// Create cpu load reader.
cpuLoadReader, err := cpuload.New()
if err != nil {
@ -189,9 +191,10 @@ func (self *manager) Start() error {
self.loadReader = cpuLoadReader
}
}
}
// Watch for OOMs.
err = self.watchForNewOoms()
err := self.watchForNewOoms()
if err != nil {
glog.Errorf("Failed to start OOM watcher, will not get OOM events: %v", err)
}