Skip to content

Commit

Permalink
Treat ATA errors as warnings, allow using warn_list
Browse files Browse the repository at this point in the history
  • Loading branch information
deric committed Sep 12, 2024
1 parent 357edaa commit db73b85
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions check_smart.pl
Original file line number Diff line number Diff line change
Expand Up @@ -768,12 +768,20 @@
if ($output_mode =~ "ata") {
foreach my $line(@output){
next unless $line =~ /^ATA Error Count:\s(\d+)\s/;
my ($error_count) = ($1);
if ($error_count > 0){
push(@error_messages, "ATA Error Count is non-zero ($error_count)");
escalate_status('CRITICAL');
push (@perfdata, "ata_errors=$error_count;;;;")
my ($attribute_name, $raw_value) = ('ata_errors', $1);
if ( ($warn_list{$attribute_name}) && ($raw_value >= $warn_list{$attribute_name}) ) {
warn "(debug) $attribute_name is non-zero ($raw_value)\n\n" if $opt_debug;
push(@warning_messages, "$attribute_name is non-zero ($raw_value)");
escalate_status('WARNING');
} elsif ( ($warn_list{$attribute_name}) && ($raw_value < $warn_list{$attribute_name}) ) {
warn "(debug) $attribute_name is non-zero ($raw_value) but less than $warn_list{$attribute_name}\n\n" if $opt_debug;
push(@notice_messages, "$attribute_name is non-zero ($raw_value) (but less than threshold $warn_list{$attribute_name})");
} else {
warn "(debug) $attribute_name is non-zero ($raw_value)\n\n" if $opt_debug;
push(@warning_messages, "$attribute_name is non-zero ($raw_value)");
escalate_status('WARNING');
}
push (@perfdata, "$attribute_name=$raw_value;;;;")
}
}
}
Expand Down

0 comments on commit db73b85

Please sign in to comment.