@cryptotaxi247 / netdata-1 / commits / cf77af7cb

fix interval problems

paulfantom committed Jun 13, 2016 at 14:40 UTC cf77af7cbbd11243fc28892b50bc94747d157758
1 file changed +6 -7
plugins.d/python.d.plugin
+6 -7
@@ -22,8 +22,6 @@ class PythonCharts(object):
22 modules_configs='../conf.d/',
23 modules_disabled=[]):
24 self.first_run = True
25 - if interval is None:
26 - interval = 1
25 self.default_priority = 90000
26 # set configuration directory
27 self.configs = modules_configs
@@ -42,6 +40,7 @@ class PythonCharts(object):
40 # set timetable dict (last execution, next execution and frequency)
41 # set priorities
42 self.timetable = {}
43 + freq = 1
44 for m in self.modules:
45 try:
46 m.priority = int(m.priority)
@@ -50,14 +49,14 @@ class PythonCharts(object):
49
50 if interval is None:
51 try:
53 - interval = int(m.update_every)
52 + freq = int(m.update_every)
53 except (AttributeError, ValueError):
55 - interval = 1
54 + freq = 1
55
56 now = time.time()
57 self.timetable[m.__name__] = {'last' : now,
59 - 'next' : now - (now % interval) + interval,
60 - 'freq' : interval}
58 + 'next' : now - (now % freq) + freq,
59 + 'freq' : freq}
60
61 def _import_plugin(self, path, name=None):
62 # try to import module using only its path
@@ -288,7 +287,7 @@ def run():
287 main_dir = os.getenv('NETDATA_PLUGINS_DIR',
288 os.path.abspath(__file__).strip("python.d.plugin.py"))
289 config_dir = os.getenv('NETDATA_CONFIG_DIR', "/etc/netdata/")
291 - interval = int(os.getenv('NETDATA_UPDATE_EVERY', 1))
290 + interval = os.getenv('NETDATA_UPDATE_EVERY', None)
291
292 # read configuration file
293 disabled = []