]> arthur.barton.de Git - netdata.git/commitdiff
added support for chart priority
authorpaulfantom <paulfantom@gmail.com>
Sat, 11 Jun 2016 18:56:20 +0000 (20:56 +0200)
committerpaulfantom <paulfantom@gmail.com>
Sat, 11 Jun 2016 18:56:20 +0000 (20:56 +0200)
plugins.d/python.d.plugin
python.d/example.chart.py

index bc807c9cb1ec0d0ed3f5d535156770ad61496e47..c497968b023107e135dd9807989a2f40b2e596a0 100755 (executable)
@@ -24,6 +24,7 @@ class PythonCharts(object):
                  modules_configs='../conf.d/'):
         self.first_run = True
         self.interval = interval
+        self.default_priority = 60000
         # check if plugin directory exists
         if not os.path.isdir(modules_path):
             debug("cannot find charts directory ", modules_path)
@@ -64,6 +65,15 @@ class PythonCharts(object):
                 interval = self.interval
             # charts updates are twice as frequent as user specified
             self.timetable[m.__name__] = [0, interval/2.0]
+        
+        # set priorities
+        for m in self.modules:
+            print(m.priority)
+            try:
+                m.priority = int(m.priority)
+            except (AttributeError,ValueError):
+                m.priority = self.default_priority
+                
 
     def import_plugin(self, path, name=None):
         if name is None:
index 9742731aee2b838fb469a4b8a46302338d697ee9..c39d099779d1b1679d75b89211c7d311e34b1085 100644 (file)
@@ -1,12 +1,13 @@
 import random
 
-update_every=5
+update_every = 5
+priority = 30000
 
 def check():
     return True
 
 def create():
-    print("CHART python_example.random '' 'A random number' 'random number' random random line 90000 1")
+    print("CHART python_example.random '' 'A random number' 'random number' random random line "+str(priority)+" 1")
     print("DIMENSION random1 '' absolute 1 1")
     return True