]> arthur.barton.de Git - netdata.git/blobdiff - plugins.d/python.d.plugin
preserve configs across installaitons
[netdata.git] / plugins.d / python.d.plugin
index bb7468d8f6648fdd1fba6a643d038a76ace3a5d3..5dc4f0b0612e2f16edbae4e97c19c5dd32b93418 100755 (executable)
@@ -27,12 +27,10 @@ class PythonCharts(object):
         self.configs = modules_configs
 
         # load modules
-        self.modules = self._load_modules(modules_path,modules)
+        modules = self._load_modules(modules_path,modules)
         
         # check if loaded modules are on disabled modules list
-        for mod in self.modules:
-            if mod.__name__ in modules_disabled:
-                self.modules.remove(mod)
+        self.modules = [ m for m in modules if m.__name__ not in modules_disabled ]
         
         # load configuration files
         self._load_configs()
@@ -123,9 +121,9 @@ class PythonCharts(object):
                   "() function. Disabling it.")
         elif reason[:7] == "failed ":
             debug("chart '" +
-                  mod.__name__ +
-                  reason[3:] +
-                  "() function. reports failure.")
+                  mod.__name__ + "' " +
+                  reason[7:] +
+                  "() function reports failure.")
         elif reason[:13] == "configuration":
             debug(mod.__name__,
                   "configuration file '" +
@@ -272,6 +270,8 @@ def parse_cmdline(directory, *commands):
                 pass
 
     debug("started from", commands[0], "with options:", *commands[1:])
+    if len(mods) == 0 and DEBUG_FLAG is False:
+        interval = None
 
     return {'interval': interval,
             'modules': mods}
@@ -292,9 +292,8 @@ def run():
     # read configuration file
     disabled = []
     if config_dir[-1] != '/':
-        configfile = config_dir + '/' + "python.d.conf"
-    else:
-        configfile = config_dir + "python.d.conf"
+        config_dir += '/'
+    configfile = config_dir + "python.d.conf"
 
     try:
         conf = read_config(configfile)