-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Percent_Lifetime_Remain threshold unset with -w #92
Comments
Can you show the current Percent_Lifetime_Remain value? |
|
Agree, simply adding a |
@ymartin-ovh can you please try with https://raw.githubusercontent.com/Napsty/check_smart/issue-92/check_smart.pl ? does it work? |
Hello Your patch fix warning threshold when it's not given but introduce a new bug (as your set inconditionally the value): ok (threshold set to 90%) ko => |
before, I have 85% => |
Can you please run with |
|
To me it looks like the correct behaviour. Both your drives
The attribute list can be seen in the debug output. So to test the warning threshold, you must set it equal to or lower than 2:
Please try that and comment here again with your findings. PS: I just noticed that --hide-sn didn't properly work. But that's another issue to look at ;-) |
No there is an issue in your patch: ./check_smart.pl --skip-load-cycles -l -i auto -g '/dev/{sdb,sda}' -w Percent_Lifetime_Remain=85 I put 85 and the output mention 90 => but less than threshold 90 Also, in smart, lifetime value is inverted between raw value and the real meaning of lifetime remaining percentage. This is explained in drive datasheet and also in check_smart perl code. |
Ah yes, now I see it. |
Let me try to comprehend the issue correctly. When you want to use the Percent_Lifetime_Remain check, using
But when you want to overwrite the Percent_Lifetime_Remain threshold (let's say 50), then your own threshold is overwritten again with 90:
Is that the problem this issue is about? Or did I misunderstand something? Note: I faked the SMARTCTL output on this drive, as the Samsung SSDs don't have a Percent_Lifetime_Remain attribute. |
Initially my isssue is when -w is used with another threshold definition like Reallocated_Sector_Ct, Percent_Lifetime_Remain=90 is not pushed in the warn_list (see: |
Yep, but this should now work.
Can you confirm with the latest version? -> https://raw.githubusercontent.com/Napsty/check_smart/issue-92/check_smart.pl |
…en (issue Napsty#92) Address issue when threshold is not set in the following case: check_smart -i auto -g '/dev/sda' -w Reallocated_Sector_Ct=250 -l Instead of 90, the threshold is 0 when -w is given without Percent_Lifetime_Remain threshold.
No your patch overwrite the user given value because of the push at the warn_list tail. The default value should be in the head of the list to do this properly. Eventually, I provide a fix in #93. Regards |
Thx for the PR. Please set your if condition in line 231: This way the Percent_Lifetime_Remain threshold is only set once and added to the warn_list array from the beginning. |
The if condition l231 is not needed anymore as it is implemented l240 in #93 |
Just tested it locally, lgtm
|
Fixed with #93 |
Hello
It seems there is an issue on -w option handling. When I give a threshold for a particular smartctl item (not lifetime), the Percent_Lifetime_Remain threshold is not set to 90%:
warning => ./check_smart -i auto -g '/dev/sda' -w Reallocated_Sector_Ct=250 -l
ok => ./check_smart -i auto -g '/dev/sda' -w Reallocated_Sector_Ct=250,Percent_Lifetime_Remain=90 -l
ok => ./check_smart -i auto -g '/dev/sda' -l
Before working on a patch, can you tell me if this behaviour is normal or not.
Regards
The text was updated successfully, but these errors were encountered: