From 1fa57228447abc46d58bcc377ab373c026ccd008 Mon Sep 17 00:00:00 2001 From: Philip Knirsch Date: Wed, 25 Feb 2009 11:28:06 +0100 Subject: - Add init() methods to each plugin - Call plugin init() methods during tuned's init() - Add support for command line parameters o -c conffile|--config==conffile to specify the location of the config file o -d to start tuned as a daemon (instead of as normal app) - Readded the debug output in case tuned isn't started as as daemon - Fixed initialization of max transfer values for net tuning plugin --- monitorplugins/disk.py | 7 +++++-- monitorplugins/net.py | 12 ++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'monitorplugins') diff --git a/monitorplugins/disk.py b/monitorplugins/disk.py index f2844e8..16262ab 100644 --- a/monitorplugins/disk.py +++ b/monitorplugins/disk.py @@ -34,7 +34,7 @@ class DiskMonitor: self.devices[d]["max"] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] self.__updateStat__(d) self.devices[d]["max"] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] - #print self.devices + print self.devices def __calcdiff__(self, dev): @@ -56,7 +56,10 @@ class DiskMonitor: for dev in self.devices.keys(): self.__updateStat__(dev) self.devices[dev]["diff"] = self.__calcdiff__(dev) - + + def init(self, config): + self.config = config + def getLoad(self): self.__update__() ret = {} diff --git a/monitorplugins/net.py b/monitorplugins/net.py index 32042d8..caf8307 100644 --- a/monitorplugins/net.py +++ b/monitorplugins/net.py @@ -30,10 +30,11 @@ class NetMonitor: continue self.devices[d] = {} self.devices[d]["new"] = ['0', '0', '0', '0'] + # Assume 1gbit interfaces for now. FIXME: Need clean way to figure out max interface speed self.devices[d]["max"] = [70*1024*1024, 1, 70*1024*1024, 1] self.__updateStat__(d) self.devices[d]["max"] = [70*1024*1024, 1, 70*1024*1024, 1] - #print self.devices + print self.devices def __calcdiff__(self, dev): l = [] @@ -60,7 +61,14 @@ class NetMonitor: for dev in self.devices.keys(): self.__updateStat__(dev) self.devices[dev]["diff"] = self.__calcdiff__(dev) - + + def init(self, config): + self.config = config + interval = self.config.getint("main", "interval") + # Assume 1gbit interfaces for now. FIXME: Need clean way to figure out max interface speed + for d in self.devices.keys(): + self.devices[d]["max"] = [70*1024*1024*interval, 1, 70*1024*1024*interval, 1] + def getLoad(self): self.__update__() ret = {} -- cgit