Fixes #22: SMART bit string conversion is reversed#24
Fixes #22: SMART bit string conversion is reversed#24NiceGuyIT wants to merge 1 commit intoprometheus-community:masterfrom
Conversation
vagifzeynalov
left a comment
There was a problem hiding this comment.
Rather than reversing the correctly made bitmap better to change the code how to process it.
From https://linux.die.net/man/8/smartctl
Bit 0: Command line did not parse.
Bit 1: Device open failed, device did not return an IDENTIFY DEVICE structure, or device is in a low-power mode (see '-n' option above).
Bit 2: Some SMART or other ATA command to the disk failed, or there was a checksum error in a SMART data structure (see '-b' option above).
Bit 3: SMART status check returned "DISK FAILING".
Bit 4: We found prefail Attributes <= threshold.
Bit 5: SMART status check returned "DISK OK" but we found that some (usage or prefail) Attributes have been <= threshold at some time in the past.
Bit 6: The device error log contains records of errors.
Bit 7: The device self-test log contains records of errors. [ATA only] Failed self-tests outdated by a newer successful extended self-test are ignored.
|
I have replaced the string/byte comparisons with integer/bit comparisons. |
|
Perhaps, if you want to make it perfect, all messages along with true/false results should be stored as an object in the list. So you can do something like |
|
in fact, the whole method could be collapsed into simple check of first two bits. |
|
I think #37 was a simpler fix. |
No description provided.