smartd_log: attrs 3, 194 fix (#5923)
* ata194 fix * ata3 fix
Ilya Mashchenko committed
Apr 27, 2019 at 00:07 UTC
43ab7d18abc21faf6b350efc933e4c5bdbfb407b
1 file changed
+24
-1
collectors/python.d.plugin/smartd_log/smartd_log.chart.py
+24
-1
@@ -440,6 +440,20 @@ class AtaNormalized(BaseAtaSmartAttribute):
440
return self.normalized_value
441
442
443
+class Ata3(BaseAtaSmartAttribute):
444
+ def value(self):
445
+ value = int(self.raw_value)
446
+ # https://github.com/netdata/netdata/issues/5919
447
+ #
448
+ # 3;151;38684000679;
449
+ # 423 (Average 447)
450
+ # 38684000679 & 0xFFF -> 423
451
+ # (38684000679 & 0xFFF0000) >> 16 -> 447
452
+ if value > 1e6:
453
+ return value & 0xFFF
454
+ return value
455
+
456
+
457
class Ata9(BaseAtaSmartAttribute):
458
def value(self):
459
value = int(self.raw_value)
@@ -454,7 +468,14 @@ class Ata190(BaseAtaSmartAttribute):
468
469
470
class Ata194(BaseAtaSmartAttribute):
471
+ # https://github.com/netdata/netdata/issues/3041
472
+ # https://github.com/netdata/netdata/issues/5919
473
+ #
474
+ # The low byte is the current temperature, the third lowest is the maximum, and the fifth lowest is the minimum
475
def value(self):
476
+ value = int(self.raw_value)
477
+ if value > 1e6:
478
+ return value & 0xFF
479
return min(int(self.normalized_value), int(self.raw_value))
480
481
@@ -475,7 +496,9 @@ class SCSIRaw(BaseSCSISmartAttribute):
496
def ata_attribute_factory(value):
497
name = value[0]
498
478
- if name == ATTR9:
499
+ if name == ATTR3:
500
+ return Ata3(*value)
501
+ elif name == ATTR9:
502
return Ata9(*value)
503
elif name == ATTR190:
504
return Ata190(*value)