From cf77af7cbbd11243fc28892b50bc94747d157758 Mon Sep 17 00:00:00 2001 From: paulfantom Date: Mon, 13 Jun 2016 14:40:55 +0200 Subject: [PATCH] fix interval problems --- plugins.d/python.d.plugin | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins.d/python.d.plugin b/plugins.d/python.d.plugin index 350e5679..bb7468d8 100755 --- a/plugins.d/python.d.plugin +++ b/plugins.d/python.d.plugin @@ -22,8 +22,6 @@ class PythonCharts(object): modules_configs='../conf.d/', modules_disabled=[]): self.first_run = True - if interval is None: - interval = 1 self.default_priority = 90000 # set configuration directory self.configs = modules_configs @@ -42,6 +40,7 @@ class PythonCharts(object): # set timetable dict (last execution, next execution and frequency) # set priorities self.timetable = {} + freq = 1 for m in self.modules: try: m.priority = int(m.priority) @@ -50,14 +49,14 @@ class PythonCharts(object): if interval is None: try: - interval = int(m.update_every) + freq = int(m.update_every) except (AttributeError, ValueError): - interval = 1 + freq = 1 now = time.time() self.timetable[m.__name__] = {'last' : now, - 'next' : now - (now % interval) + interval, - 'freq' : interval} + 'next' : now - (now % freq) + freq, + 'freq' : freq} def _import_plugin(self, path, name=None): # try to import module using only its path @@ -288,7 +287,7 @@ def run(): main_dir = os.getenv('NETDATA_PLUGINS_DIR', os.path.abspath(__file__).strip("python.d.plugin.py")) config_dir = os.getenv('NETDATA_CONFIG_DIR', "/etc/netdata/") - interval = int(os.getenv('NETDATA_UPDATE_EVERY', 1)) + interval = os.getenv('NETDATA_UPDATE_EVERY', None) # read configuration file disabled = [] -- 2.39.2