From bb8713bbc1c4594366fc735c04910edbf4c61aab Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 31 Mar 2021 14:59:21 +0200 Subject: Merging upstream version 1.30.0. Signed-off-by: Daniel Baumann --- collectors/python.d.plugin/example/example.chart.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'collectors/python.d.plugin/example/example.chart.py') 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 -- cgit v1.2.3