From 92e728e76b2354521f359d427d15734423a42b85 Mon Sep 17 00:00:00 2001 From: Xuefer Date: Fri, 9 Sep 2016 03:22:20 +0800 Subject: [PATCH] sensors: fix grouping when only single sensor is available, everything is groupped into temperature --- python.d/sensors.chart.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/python.d/sensors.chart.py b/python.d/sensors.chart.py index 7abe7f08..6fb702ae 100644 --- a/python.d/sensors.chart.py +++ b/python.d/sensors.chart.py @@ -92,7 +92,6 @@ class Service(SimpleService): return data def _create_definitions(self): - prev_chip = "" for type in ORDER: for chip in sensors.ChipIterator(): chip_name = sensors.chip_snprintf_name(chip) @@ -105,19 +104,17 @@ class Service(SimpleService): continue if TYPE_MAP[feature.type] == type: # create chart - if chip_name != prev_chip: - name = chip_name + "_" + TYPE_MAP[feature.type] - if name not in self.order: - self.order.append(name) - chart_def = list(CHARTS[type]['options']) - chart_def[1] = chip_name + chart_def[1] - self.definitions[name] = {'options': chart_def} - self.definitions[name]['lines'] = [] + name = chip_name + "_" + TYPE_MAP[feature.type] + if name not in self.order: + self.order.append(name) + chart_def = list(CHARTS[type]['options']) + chart_def[1] = chip_name + chart_def[1] + self.definitions[name] = {'options': chart_def} + self.definitions[name]['lines'] = [] line = list(CHARTS[type]['lines'][0]) line[0] = chip_name + "_" + str(feature.name.decode()) line[1] = sensors.get_label(chip, feature) self.definitions[name]['lines'].append(line) - prev_chip = chip_name def check(self): try: -- 2.39.2