- smart: fixed overall health color - smart: added WHEN_FAILED checking

This commit is contained in:
Jacek Tomasiak 2020-03-06 09:03:30 +01:00 committed by Gardais Jérémy
parent b5678dffe2
commit af5c5d4ef4
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 6 additions and 3 deletions

View File

@ -73,12 +73,12 @@ if (time() - $mtime > $CACHETIME * 60)
if ($line =~ /.*overall-health.*:\s*(.*)/) if ($line =~ /.*overall-health.*:\s*(.*)/)
{ {
my $lstatus = ($1 == 'PASSED') ? 'green' : 'red'; my $lstatus = ($1 eq 'PASSED') ? 'green' : 'red';
print OUT "&$lstatus $line"; print OUT "&$lstatus $line";
} }
elsif ($line =~ /^\s*(\d+)\s+(\S+)\s+\S+\s+(\d+)\s+(\d+)\s+(\d+)\s+\S+\s+\S+\s+\S+\s+(.*)$/) elsif ($line =~ /^\s*(\d+)\s+(\S+)\s+\S+\s+(\d+)\s+(\d+)\s+(\d+)\s+\S+\s+\S+\s+(\S+)\s+(.*)$/)
{ {
my ($aname, $value, $worst, $thresh, $raw) = ($2, $3, $4, $5, $6); my ($aname, $value, $worst, $thresh, $failure, $raw) = ($2, $3, $4, $5, $6, $7);
my $lstatus = 'green'; my $lstatus = 'green';
if ($aname =~ /Current_Pending_Sector|Offline_Uncorrectable/ and int($raw) > 0) if ($aname =~ /Current_Pending_Sector|Offline_Uncorrectable/ and int($raw) > 0)
{ {
@ -88,6 +88,9 @@ if (time() - $mtime > $CACHETIME * 60)
{ {
$ponhours = $raw; $ponhours = $raw;
} }
if ($failure =~ /FAIL/) {
$lstatus = 'red';
}
print OUT "&$lstatus $line"; print OUT "&$lstatus $line";