From f0e704ce955d0ab5229fbb3941a892968bbf16d6 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 16 Jul 2021 10:15:01 +0200 Subject: [PATCH] Do not count Unconfigured(good) drives as an error --- zabbix_scripts/check_raid_megaraid_sudo | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zabbix_scripts/check_raid_megaraid_sudo b/zabbix_scripts/check_raid_megaraid_sudo index b76fcd7..d9e2a54 100755 --- a/zabbix_scripts/check_raid_megaraid_sudo +++ b/zabbix_scripts/check_raid_megaraid_sudo @@ -183,7 +183,7 @@ ADAPTER: for ( my $adp = 0; $adp < $adapters; $adp++ ) { open (PDLIST, "$megacli -PdList -a$adp -NoLog |") || die "error: Could not execute $megacli -PdList -a$adp -NoLog"; - my ($slotnumber,$fwstate); + my ($slotnumber,$fwstate,$fwinfo); PDISKS: while () { if ( m/Slot Number:\s*(\d+)/ ) { $slotnumber = $1; @@ -198,12 +198,15 @@ ADAPTER: for ( my $adp = 0; $adp < $adapters; $adp++ ) { } } elsif ( m/Predictive Failure Count:\s*(\d+)/ ) { $prederrors += $1; - } elsif ( m/Firmware state:\s*(\w+)/ ) { + } elsif ( m/Firmware state:\s*(\w+)(.*)/ ) { $fwstate = $1; + $fwinfo = $2; if ( $fwstate =~ m/Hotspare/ ) { $hotsparecount++; } elsif ( $fwstate =~ m/^Online/ ) { # Do nothing + } elsif ( $fwstate =~ m/^Unconfigured/ && defined $fwinfo && $fwinfo =~ m/^\(good\)/) { + # Do nothing } elsif ( $slotnumber != 255 ) { $pdbad++; $status = 'CRITICAL';