]> arthur.barton.de Git - netdata.git/blobdiff - plugins.d/python.d.plugin
notify user when sth wrong in update()
[netdata.git] / plugins.d / python.d.plugin
index c7ef06b3080e3b971e6b425a91a7609e6da84c0e..167e6e3db2943320d3c373cad54f8f0a7a958da6 100755 (executable)
@@ -128,7 +128,7 @@ class PythonCharts(object):
                   mod.__name__ +
                   ".conf' not found. Using defaults.")
         elif reason[:11] == "misbehaving":
-            debug(mod.__name__, "is misbeaving. Disabling it")
+            debug(mod.__name__, "is "+reason)
 
     def check(self):
         for mod in self.modules:
@@ -178,8 +178,8 @@ class PythonCharts(object):
         except AttributeError:
             self.disable_module(mod, "no update")
             return
-        except UnboundLocalError:
-            self.disable_module(mod, "misbehaving")
+        except (UnboundLocalError, Exception) as e:
+            self.disable_module(mod, "misbehaving. Reason: " + str(e))
             return
         t_end = time.time()
         self.timetable[mod.__name__]['next'] = t_end - (t_end % self.timetable[mod.__name__]['freq']) + self.timetable[mod.__name__]['freq']
@@ -201,7 +201,14 @@ class PythonCharts(object):
             next_runs = []
             for mod in self.modules:
                 self.update_module(mod)
-                next_runs.append(self.timetable[mod.__name__]['next'])
+                try:
+                    next_runs.append(self.timetable[mod.__name__]['next'])
+                except KeyError:
+                    pass
+            if len(next_runs) == 0:
+                debug("No plugins loaded")
+                sys.stdout.write("DISABLE\n")
+                sys.exit(1)
             time.sleep(min(next_runs) - time.time())