@cryptotaxi247 / netdata-1 / commits / 7827c6f4f

adding a default job with some params and example of additional job. (#10777)

* adding a default job with some params and example of additional job.

Andrew Maguire committed Mar 23, 2021 at 14:30 UTC 7827c6f4f5c11fa205f4c0ad8c1367d49e2f58a4
2 files changed +27 -5
collectors/python.d.plugin/example/example.chart.py
+5 -2
@@ -29,6 +29,9 @@ class Service(SimpleService):
29 self.order = ORDER
30 self.definitions = CHARTS
31 self.random = SystemRandom()
32 + self.num_lines = self.configuration.get('num_lines', 4)
33 + self.lower = self.configuration.get('lower', 0)
34 + self.upper = self.configuration.get('upper', 100)
35
36 @staticmethod
37 def check():
@@ -37,12 +40,12 @@ class Service(SimpleService):
40 def get_data(self):
41 data = dict()
42
40 - for i in range(1, 4):
43 + for i in range(0, self.num_lines):
44 dimension_id = ''.join(['random', str(i)])
45
46 if dimension_id not in self.charts['random']:
47 self.charts['random'].add_dimension([dimension_id])
48
46 - data[dimension_id] = self.random.randint(0, 100)
49 + data[dimension_id] = self.random.randint(self.lower, self.upper)
50
51 return data
collectors/python.d.plugin/example/example.conf
+22 -3
@@ -51,7 +51,7 @@
51 # predefined parameters. These are:
52 #
53 # job_name:
54 -# name: myname # the JOB's name as it will appear at the
54 +# name: myname # the JOB's name as it will appear on the dashboard
55 # # dashboard (by default is the job_name)
56 # # JOBs sharing a name are mutually exclusive
57 # update_every: 1 # the JOB's data collection frequency
@@ -61,8 +61,27 @@
61 #
62 # Additionally to the above, example also supports the following:
63 #
64 -# - none
64 +# num_lines: 4 # the number of lines to create
65 +# lower: 0 # the lower bound of numbers to randomly sample from
66 +# upper: 100 # the upper bound of numbers to randomly sample from
67 #
68 # ----------------------------------------------------------------------
69 # AUTO-DETECTION JOBS
68 -# only one of them will run (they have the same name)
70 +
71 +four_lines:
72 + name: "Four Lines" # the JOB's name as it will appear on the dashboard
73 + update_every: 1 # the JOB's data collection frequency
74 + priority: 60000 # the JOB's order on the dashboard
75 + penalty: yes # the JOB's penalty
76 + autodetection_retry: 0 # the JOB's re-check interval in seconds
77 + num_lines: 4 # the number of lines to create
78 + lower: 0 # the lower bound of numbers to randomly sample from
79 + upper: 100 # the upper bound of numbers to randomly sample from
80 +
81 +# if you wanted to make another job to run in addition to the one above then
82 +# you would just uncomment the job configuration below.
83 +# two_lines:
84 +# name: "Two Lines" # the JOB's name as it will appear on the dashboard
85 +# num_lines: 2 # the number of lines to create
86 +# lower: 50 # the lower bound of numbers to randomly sample from
87 +# upper: 75 # the upper bound of numbers to randomly sample from