diff options
Diffstat (limited to 'collectors/python.d.plugin/example')
-rw-r--r-- | collectors/python.d.plugin/example/example.chart.py | 7 | ||||
-rw-r--r-- | collectors/python.d.plugin/example/example.conf | 25 |
2 files changed, 27 insertions, 5 deletions
diff --git a/collectors/python.d.plugin/example/example.chart.py b/collectors/python.d.plugin/example/example.chart.py index 61ae47f22..d6c0b6658 100644 --- a/collectors/python.d.plugin/example/example.chart.py +++ b/collectors/python.d.plugin/example/example.chart.py @@ -29,6 +29,9 @@ class Service(SimpleService): self.order = ORDER self.definitions = CHARTS self.random = SystemRandom() + self.num_lines = self.configuration.get('num_lines', 4) + self.lower = self.configuration.get('lower', 0) + self.upper = self.configuration.get('upper', 100) @staticmethod def check(): @@ -37,12 +40,12 @@ class Service(SimpleService): def get_data(self): data = dict() - for i in range(1, 4): + for i in range(0, self.num_lines): dimension_id = ''.join(['random', str(i)]) if dimension_id not in self.charts['random']: self.charts['random'].add_dimension([dimension_id]) - data[dimension_id] = self.random.randint(0, 100) + data[dimension_id] = self.random.randint(self.lower, self.upper) return data diff --git a/collectors/python.d.plugin/example/example.conf b/collectors/python.d.plugin/example/example.conf index 3d8435173..31261b840 100644 --- a/collectors/python.d.plugin/example/example.conf +++ b/collectors/python.d.plugin/example/example.conf @@ -51,7 +51,7 @@ # predefined parameters. These are: # # job_name: -# name: myname # the JOB's name as it will appear at the +# name: myname # the JOB's name as it will appear on the dashboard # # dashboard (by default is the job_name) # # JOBs sharing a name are mutually exclusive # update_every: 1 # the JOB's data collection frequency @@ -61,8 +61,27 @@ # # Additionally to the above, example also supports the following: # -# - none +# num_lines: 4 # the number of lines to create +# lower: 0 # the lower bound of numbers to randomly sample from +# upper: 100 # the upper bound of numbers to randomly sample from # # ---------------------------------------------------------------------- # AUTO-DETECTION JOBS -# only one of them will run (they have the same name) + +four_lines: + name: "Four Lines" # the JOB's name as it will appear on the dashboard + update_every: 1 # the JOB's data collection frequency + priority: 60000 # the JOB's order on the dashboard + penalty: yes # the JOB's penalty + autodetection_retry: 0 # the JOB's re-check interval in seconds + num_lines: 4 # the number of lines to create + lower: 0 # the lower bound of numbers to randomly sample from + upper: 100 # the upper bound of numbers to randomly sample from + +# if you wanted to make another job to run in addition to the one above then +# you would just uncomment the job configuration below. +# two_lines: +# name: "Two Lines" # the JOB's name as it will appear on the dashboard +# num_lines: 2 # the number of lines to create +# lower: 50 # the lower bound of numbers to randomly sample from +# upper: 75 # the upper bound of numbers to randomly sample from |