summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Maguire <andrewm4894@gmail.com>2021-03-23 14:30:46 +0000
committerGitHub <noreply@github.com>2021-03-23 14:30:46 +0000
commit7827c6f4f5c11fa205f4c0ad8c1367d49e2f58a4 (patch)
tree9aae3b939c205fbf77d4d053f8340a7e4f6834d4
parent04ce5769b82d1dc2b17b33eecfe23022febe5265 (diff)
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.
-rw-r--r--collectors/python.d.plugin/example/example.chart.py7
-rw-r--r--collectors/python.d.plugin/example/example.conf25
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 61ae47f22d..d6c0b6658f 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 3d84351730..31261b8408 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