sensors: fix grouping
when only single sensor is available, everything is groupped into temperature
Xuefer committed
Sep 9, 2016 at 03:22 UTC
92e728e76b2354521f359d427d15734423a42b85
1 file changed
+7
-10
python.d/sensors.chart.py
+7
-10
@@ -92,7 +92,6 @@ class Service(SimpleService):
92
return data
93
94
def _create_definitions(self):
95
- prev_chip = ""
95
for type in ORDER:
96
for chip in sensors.ChipIterator():
97
chip_name = sensors.chip_snprintf_name(chip)
@@ -105,19 +104,17 @@ class Service(SimpleService):
104
continue
105
if TYPE_MAP[feature.type] == type:
106
# create chart
108
- if chip_name != prev_chip:
109
- name = chip_name + "_" + TYPE_MAP[feature.type]
110
- if name not in self.order:
111
- self.order.append(name)
112
- chart_def = list(CHARTS[type]['options'])
113
- chart_def[1] = chip_name + chart_def[1]
114
- self.definitions[name] = {'options': chart_def}
115
- self.definitions[name]['lines'] = []
107
+ name = chip_name + "_" + TYPE_MAP[feature.type]
108
+ if name not in self.order:
109
+ self.order.append(name)
110
+ chart_def = list(CHARTS[type]['options'])
111
+ chart_def[1] = chip_name + chart_def[1]
112
+ self.definitions[name] = {'options': chart_def}
113
+ self.definitions[name]['lines'] = []
114
line = list(CHARTS[type]['lines'][0])
115
line[0] = chip_name + "_" + str(feature.name.decode())
116
line[1] = sensors.get_label(chip, feature)
117
self.definitions[name]['lines'].append(line)
120
- prev_chip = chip_name
118
119
def check(self):
120
try: