@cryptotaxi247 / netdata-1 / commits / 3c1be6e2e

Fix smartd attributes in python2 and allow custom order

Patrick Koenig committed Jun 11, 2017 at 00:33 UTC 3c1be6e2ef92a7c2c193f94fa25531e1c224f4f1
1 file changed +6 -5
python.d/smartd_log.chart.py
+6 -5
@@ -197,11 +197,12 @@ class Service(SimpleService):
197 result.append(['_'.join([name, attrid]), name[:name.index('.')], 'absolute'])
198 return result
199
200 - # Add additional smart attributes to the ORDER. If something goes wrong we don't care.
201 - try:
202 - ORDER.extend(list(set(self.attr.split()) & SMART_ATTR.keys() - set(ORDER)))
203 - except Exception:
204 - pass
200 + # Use configured attributes, if present. If something goes wrong we don't care.
201 + if self.attr:
202 + try:
203 + ORDER = [attr for attr in self.attr.split() if attr in SMART_ATTR.keys()]
204 + except Exception:
205 + pass
206 self.order = [''.join(['attrid', i]) for i in ORDER]
207 self.definitions = dict()
208 units = 'raw' if self.raw_values else 'normalized'