Skip to content

Commit 43ab7d1

Browse files
authored
smartd_log: attrs 3, 194 fix (netdata#5923)
* ata194 fix * ata3 fix
1 parent e91b9ca commit 43ab7d1

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

collectors/python.d.plugin/smartd_log/smartd_log.chart.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,20 @@ def value(self):
440440
return self.normalized_value
441441

442442

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+
443457
class Ata9(BaseAtaSmartAttribute):
444458
def value(self):
445459
value = int(self.raw_value)
@@ -454,7 +468,14 @@ def value(self):
454468

455469

456470
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
457475
def value(self):
476+
value = int(self.raw_value)
477+
if value > 1e6:
478+
return value & 0xFF
458479
return min(int(self.normalized_value), int(self.raw_value))
459480

460481

@@ -475,7 +496,9 @@ def value(self):
475496
def ata_attribute_factory(value):
476497
name = value[0]
477498

478-
if name == ATTR9:
499+
if name == ATTR3:
500+
return Ata3(*value)
501+
elif name == ATTR9:
479502
return Ata9(*value)
480503
elif name == ATTR190:
481504
return Ata190(*value)

0 commit comments

Comments
 (0)