diff --git a/lib/App/Monitoring/Plugin/CheckRaid/Plugins/tw_cli.pm b/lib/App/Monitoring/Plugin/CheckRaid/Plugins/tw_cli.pm index 0a792acc..17fdf51b 100644 --- a/lib/App/Monitoring/Plugin/CheckRaid/Plugins/tw_cli.pm +++ b/lib/App/Monitoring/Plugin/CheckRaid/Plugins/tw_cli.pm @@ -433,7 +433,7 @@ sub check { $this->warning; $s .= " $u->{vim_percent}"; - } elsif ($s eq 'VERIFYING') { + } elsif ($s =~ /VERIFYING|VERIFY-PAUSED/) { $this->check_status; $s .= " $u->{vim_percent}"; @@ -464,7 +464,7 @@ sub check { foreach my $p (sort { $a cmp $b } keys %{$c->{drivestatus}}) { my $d = $c->{drivestatus}->{$p}; my $ds = $d->{status}; - if ($ds eq 'VERIFYING') { + if ($ds =~ /VERIFYING|VERIFY-PAUSED/) { $this->check_status; } elsif ($ds ne 'OK') { $this->critical; diff --git a/t/check_tw_cli.t b/t/check_tw_cli.t index 1711bc30..93abd0f5 100755 --- a/t/check_tw_cli.t +++ b/t/check_tw_cli.t @@ -92,6 +92,16 @@ my @tests = ( message => 'c0(9750-4i): u0(RAID-6): VERIFYING 29%(A), Cache:RiW, c0(9750-4i): u1(RAID-6): VERIFYING 18%(A), Cache:RiW, c0(9750-4i): u2(SPARE): VERIFYING 14%, c0(9750-4i): u3(SPARE): VERIFYING 0%, Drives(18): p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p8=OK p25,p9=VERIFYING, Enclosure: /c0/e0(fan0=OK(2670),fan1=OK(9500),fan2=OK(8540),fan3=OK(2830),fan4=OK(9120),fan5=OK(8330),temp0=OK(41C),temp1=OK(38C),temp2=OK(34C),temp3=OK(38C),temp4=OK(38C),temp5=OK(34C),pwrs0=OK(status=on,voltage=OK,current=OK),pwrs1=OK(status=on,voltage=OK,current=OK),slot0=OK,slot10=OK,slot2=OK,slot3=OK,slot4=OK,slot5=OK,slot6=OK,slot7=OK,slot8=OK,slot9=OK)', c => 'bootc-enc', }, + { + status => OK, + info => 'sysiphus/info', + show => 'sysiphus/show', + unitstatus => 'sysiphus/info.c0.unitstatus', + drivestatus => 'sysiphus/info.c0.drivestatus', + bbustatus => 'sysiphus/info.c0.bbustatus', + message => 'c0(9650SE-16ML): u0(RAID-10): VERIFYING 25%, Cache:W, c0(9650SE-16ML): u1(SPARE): VERIFY-PAUSED 0%, c0(9650SE-16ML): u2(SPARE): VERIFY-PAUSED 0%, Drives(12): p0,p1,p2,p3,p4,p5,p6,p7,p8,p9=OK p10,p11=VERIFYING, BBU: OK(Volt=OK,Temp=OK,Hours=255,LastCapTest=07-May-2022)', + c => 'sysiphus', + }, { status => OK, info => 'grubbs/info', diff --git a/t/data/tw_cli/sysiphus/info b/t/data/tw_cli/sysiphus/info new file mode 100644 index 00000000..f6f52dd2 --- /dev/null +++ b/t/data/tw_cli/sysiphus/info @@ -0,0 +1,5 @@ + +Ctl Model (V)Ports Drives Units NotOpt RRate VRate BBU +------------------------------------------------------------------------ +c0 9650SE-16ML 16 12 3 0 1 1 OK + diff --git a/t/data/tw_cli/sysiphus/info.c0.bbustatus b/t/data/tw_cli/sysiphus/info.c0.bbustatus new file mode 100644 index 00000000..21f8293e --- /dev/null +++ b/t/data/tw_cli/sysiphus/info.c0.bbustatus @@ -0,0 +1,5 @@ + +Name OnlineState BBUReady Status Volt Temp Hours LastCapTest +--------------------------------------------------------------------------- +bbu On Yes OK OK OK 255 07-May-2022 + diff --git a/t/data/tw_cli/sysiphus/info.c0.drivestatus b/t/data/tw_cli/sysiphus/info.c0.drivestatus new file mode 100644 index 00000000..52a72ca3 --- /dev/null +++ b/t/data/tw_cli/sysiphus/info.c0.drivestatus @@ -0,0 +1,16 @@ + +VPort Status Unit Size Type Phy Encl-Slot Model +------------------------------------------------------------------------------ +p0 OK u0 298.09 GB SATA 0 - ST3320620AS +p1 OK u0 298.09 GB SATA 1 - ST3320620AS +p2 OK u0 298.09 GB SATA 2 - ST3320620AS +p3 OK u0 298.09 GB SATA 3 - ST3320620AS +p4 OK u0 298.09 GB SATA 4 - ST3320620AS +p5 OK u0 298.09 GB SATA 5 - ST3320620AS +p6 OK u0 298.09 GB SATA 6 - ST3320620AS +p7 OK u0 298.09 GB SATA 7 - ST3320620AS +p8 OK u0 298.09 GB SATA 8 - ST3320620AS +p9 OK u0 298.09 GB SATA 9 - ST3320620AS +p10 VERIFYING u1 298.09 GB SATA 10 - ST3320620AS +p11 VERIFYING u2 298.09 GB SATA 11 - ST3320620AS + diff --git a/t/data/tw_cli/sysiphus/info.c0.unitstatus b/t/data/tw_cli/sysiphus/info.c0.unitstatus new file mode 100644 index 00000000..9e356d55 --- /dev/null +++ b/t/data/tw_cli/sysiphus/info.c0.unitstatus @@ -0,0 +1,7 @@ + +Unit UnitType Status %RCmpl %V/I/M Stripe Size(GB) Cache AVrfy +------------------------------------------------------------------------------ +u0 RAID-10 VERIFYING - 25% 64K 1490.06 W ON +u1 SPARE VERIFY-PAUSED - 0% - 298.082 - ON +u2 SPARE VERIFY-PAUSED - 0% - 298.082 - ON + diff --git a/t/data/tw_cli/sysiphus/show b/t/data/tw_cli/sysiphus/show new file mode 120000 index 00000000..06e55476 --- /dev/null +++ b/t/data/tw_cli/sysiphus/show @@ -0,0 +1 @@ +info \ No newline at end of file diff --git a/t/dump/tw_cli/sysiphus b/t/dump/tw_cli/sysiphus new file mode 100644 index 00000000..744bb785 --- /dev/null +++ b/t/dump/tw_cli/sysiphus @@ -0,0 +1,165 @@ +$VAR1 = { + 'c0' => { + 'bbu' => 'OK', + 'bbustatus' => { + 'bbu' => { + 'BBUReady' => 'Yes', + 'Hours' => '255', + 'LastCapTest' => '07-May-2022', + 'OnlineState' => 'On', + 'Status' => 'OK', + 'Temp' => 'OK', + 'Volt' => 'OK' + } + }, + 'drives' => 12, + 'drivestatus' => { + 'p0' => { + 'encl' => '-', + 'model' => 'ST3320620AS', + 'phy' => 0, + 'size' => '298.09 GB', + 'status' => 'OK', + 'type' => 'SATA', + 'unit' => 'u0' + }, + 'p1' => { + 'encl' => '-', + 'model' => 'ST3320620AS', + 'phy' => 1, + 'size' => '298.09 GB', + 'status' => 'OK', + 'type' => 'SATA', + 'unit' => 'u0' + }, + 'p10' => { + 'encl' => '-', + 'model' => 'ST3320620AS', + 'phy' => 10, + 'size' => '298.09 GB', + 'status' => 'VERIFYING', + 'type' => 'SATA', + 'unit' => 'u1' + }, + 'p11' => { + 'encl' => '-', + 'model' => 'ST3320620AS', + 'phy' => 11, + 'size' => '298.09 GB', + 'status' => 'VERIFYING', + 'type' => 'SATA', + 'unit' => 'u2' + }, + 'p2' => { + 'encl' => '-', + 'model' => 'ST3320620AS', + 'phy' => 2, + 'size' => '298.09 GB', + 'status' => 'OK', + 'type' => 'SATA', + 'unit' => 'u0' + }, + 'p3' => { + 'encl' => '-', + 'model' => 'ST3320620AS', + 'phy' => 3, + 'size' => '298.09 GB', + 'status' => 'OK', + 'type' => 'SATA', + 'unit' => 'u0' + }, + 'p4' => { + 'encl' => '-', + 'model' => 'ST3320620AS', + 'phy' => 4, + 'size' => '298.09 GB', + 'status' => 'OK', + 'type' => 'SATA', + 'unit' => 'u0' + }, + 'p5' => { + 'encl' => '-', + 'model' => 'ST3320620AS', + 'phy' => 5, + 'size' => '298.09 GB', + 'status' => 'OK', + 'type' => 'SATA', + 'unit' => 'u0' + }, + 'p6' => { + 'encl' => '-', + 'model' => 'ST3320620AS', + 'phy' => 6, + 'size' => '298.09 GB', + 'status' => 'OK', + 'type' => 'SATA', + 'unit' => 'u0' + }, + 'p7' => { + 'encl' => '-', + 'model' => 'ST3320620AS', + 'phy' => 7, + 'size' => '298.09 GB', + 'status' => 'OK', + 'type' => 'SATA', + 'unit' => 'u0' + }, + 'p8' => { + 'encl' => '-', + 'model' => 'ST3320620AS', + 'phy' => 8, + 'size' => '298.09 GB', + 'status' => 'OK', + 'type' => 'SATA', + 'unit' => 'u0' + }, + 'p9' => { + 'encl' => '-', + 'model' => 'ST3320620AS', + 'phy' => 9, + 'size' => '298.09 GB', + 'status' => 'OK', + 'type' => 'SATA', + 'unit' => 'u0' + } + }, + 'model' => '9650SE-16ML', + 'optimal' => 1, + 'ports' => 16, + 'rrate' => 1, + 'units' => 3, + 'unitstatus' => { + 'u0' => { + 'avrify' => 'ON', + 'cache' => 'W', + 'rebuild_percent' => '-', + 'size' => '1490.06', + 'status' => 'VERIFYING', + 'strip' => '64K', + 'type' => 'RAID-10', + 'vim_percent' => '25%' + }, + 'u1' => { + 'avrify' => 'ON', + 'cache' => '-', + 'rebuild_percent' => '-', + 'size' => '298.082', + 'status' => 'VERIFY-PAUSED', + 'strip' => '-', + 'type' => 'SPARE', + 'vim_percent' => '0%' + }, + 'u2' => { + 'avrify' => 'ON', + 'cache' => '-', + 'rebuild_percent' => '-', + 'size' => '298.082', + 'status' => 'VERIFY-PAUSED', + 'strip' => '-', + 'type' => 'SPARE', + 'vim_percent' => '0%' + } + }, + 'vrate' => 1 + } + };