@cryptotaxi247 / netdata-1 / commits / 0c3fc9968

added support for chart priority

paulfantom committed Jun 11, 2016 at 20:56 UTC 0c3fc99689c646031eb305ad50542e403b38e95c
2 files changed +13 -2
plugins.d/python.d.plugin
+10
@@ -24,6 +24,7 @@ class PythonCharts(object):
24 modules_configs='../conf.d/'):
25 self.first_run = True
26 self.interval = interval
27 + self.default_priority = 60000
28 # check if plugin directory exists
29 if not os.path.isdir(modules_path):
30 debug("cannot find charts directory ", modules_path)
@@ -64,6 +65,15 @@ class PythonCharts(object):
65 interval = self.interval
66 # charts updates are twice as frequent as user specified
67 self.timetable[m.__name__] = [0, interval/2.0]
68 +
69 + # set priorities
70 + for m in self.modules:
71 + print(m.priority)
72 + try:
73 + m.priority = int(m.priority)
74 + except (AttributeError,ValueError):
75 + m.priority = self.default_priority
76 +
77
78 def import_plugin(self, path, name=None):
79 if name is None:
python.d/example.chart.py
+3 -2
@@ -1,12 +1,13 @@
1 import random
2
3 -update_every=5
3 +update_every = 5
4 +priority = 30000
5
6 def check():
7 return True
8
9 def create():
9 - print("CHART python_example.random '' 'A random number' 'random number' random random line 90000 1")
10 + print("CHART python_example.random '' 'A random number' 'random number' random random line "+str(priority)+" 1")
11 print("DIMENSION random1 '' absolute 1 1")
12 return True
13