Napsty / check_smart

Monitoring Plugin to check hard drives, solid state drives and NVMe drives using SMART
https://www.claudiokuenzler.com/monitoring-plugins/check_smart.php
GNU General Public License v3.0
67 stars 20 forks source link

Fix default Percent_Lifetime_Remain threshold handling when -w is giv… #93

Closed ymartin-ovh closed 1 year ago

ymartin-ovh commented 1 year ago

…en (issue #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.

ymartin-ovh commented 1 year ago

User given value ovetake 90% default value:

./check_smart.pl --skip-load-cycles -l -i auto -g '/dev/{sdb,sda}' -w Percent_Lifetime_Remain=85
OK: [/dev/sdb] - Device is clean [/dev/sdb] - Percent_Lifetime_Remain is non-zero (2) (but less than threshold 85) --- [/dev/sda] - Device is clean [/dev/sda] - Percent_Lifetime_Remain is non-zero (2) (but less than threshold 85)|

./check_smart.pl --skip-load-cycles -l -i auto -g '/dev/{sdb,sda}' -w Percent_Lifetime_Remain=95
OK: [/dev/sdb] - Device is clean [/dev/sdb] - Percent_Lifetime_Remain is non-zero (2) (but less than threshold 95) --- [/dev/sda] - Device is clean [/dev/sda] - Percent_Lifetime_Remain is non-zero (2) (but less than threshold 95)|

Default threshold is set to 90:

./check_smart.pl --skip-load-cycles -l -i auto -g '/dev/{sdb,sda}'
OK: [/dev/sdb] - Device is clean [/dev/sdb] - Percent_Lifetime_Remain is non-zero (2) (but less than threshold 90) --- [/dev/sda] - Device is clean [/dev/sda] - Percent_Lifetime_Remain is non-zero (2) (but less than threshold 90)|

If -w is given with an another threshold, default value is still set to 90:

./check_smart.pl --skip-load-cycles -l -i auto -g '/dev/{sdb,sda}' -w toto=2
OK: [/dev/sdb] - Device is clean [/dev/sdb] - Percent_Lifetime_Remain is non-zero (2) (but less than threshold 90) --- [/dev/sda] - Device is clean [/dev/sda] - Percent_Lifetime_Remain is non-zero (2) (but less than threshold 90)|