[Pkg-nagios-devel] Bug#575382: Bug#575382: nagios-plugins-standard: check_linux_raid does not warn if resync is in process

Christoph Martin martin at uni-mainz.de
Mon Mar 29 13:17:41 UTC 2010


Jan Wagner schrieb am 29.03.2010 00:02:
> Hi Christoph,
> 
> Okay ... found an example, hopefully equivalent to your problem:
> 
> bb:~# cat /tmp/mdstat
> Personalities : [raid1] [raid10]
> md2 : active raid1 sdd2[4] sdc2[1] sdb2[2] sda2[0]
>       16386176 blocks [4/3] [UUU_]
>         resync=DELAYED
> 
> md1 : active raid1 sdd3[4] sdc3[1] sdb3[2] sda3[0]
>       6144768 blocks [4/3] [UUU_]
>         resync=DELAYED
> 
> md3 : active raid10 sdd4[4](F) sdc4[1] sdb4[5](F) sda4[0]
>       1887974656 blocks 64K chunks 2 near-copies [4/2] [UU__]
>       [==========>..........]  recovery = 50.3% (474987648/943987328) 
> finish=4363639.0min speed=1K/sec
> 
> md0 : active raid1 sdd1[4](S) sdc1[5] sdb1[2] sda1[0]
>       10241280 blocks [4/2] [U_U_]
>         resync=DELAYED
> 
> unused devices: <none>
> 
> bb:~# /tmp/check_linux_raid md3
> WARNING md3 status=[UU__], recovery=50.3%, finish=4363639.0min.
> bb:~# /tmp/check_linux_raid_new md3
> WARNING md3 status=[UU__], recovery=recovery, finish=4363639.0min.
> bb:~# diff -Nur /tmp/check_linux_raid /tmp/check_linux_raid_new
> --- /tmp/check_linux_raid	2010-03-28 23:19:08.000000000 +0200
> +++ /tmp/check_linux_raid_new	2010-03-28 21:33:44.000000000 +0200
> @@ -61,7 +61,7 @@
>  		if (defined $device) {
>  			if (/(\[[_U]+\])/) {
>  				$status{$device} = $1;
> -			} elsif (/recovery = (.*?)\s/) {  
> +			} elsif (/(recovery|resync) = (.*?)\s/) {  
>  				$recovery{$device} = $1;
>  				($finish{$device}) = /finish=(.*?min)/;
>  			} elsif (/^\s*$/) {
> 
> I don't see, how that should help. :) Did I miss something?

I see now, that the patch is wrong. It should not output "recovery = x%"
There should be a $2 in the line below:

			} elsif (/(recovery|refresh) = (.*?)\s/) {
				$recovery{$device} = $2;



> 
> I just did have a closer look, what do you think about the following:
> 
> --- /tmp/check_linux_raid	2010-03-28 23:19:08.000000000 +0200
> +++ /tmp/check_linux_raid_new	2010-03-28 23:48:11.000000000 +0200
> @@ -50,6 +50,7 @@
>  my $msg = "";
>  my %status;
>  my %recovery;
> +my %resync;
>  my %finish;
>  my %active;
>  my %devices;
> @@ -64,6 +65,8 @@
>  			} elsif (/recovery = (.*?)\s/) {  
>  				$recovery{$device} = $1;
>  				($finish{$device}) = /finish=(.*?min)/;
> +			} elsif (/resync=(.*?)\s/) {
> +				$resync{$device} = $1;
>  			} elsif (/^\s*$/) {
>  				$device=undef;
>  			}
> @@ -84,6 +87,10 @@
>  			$msg .= sprintf " %s status=%s, recovery=%s, finish=%s.",
>  				$devices{$k}, $status{$k}, $recovery{$k}, $finish{$k};
>  			$code = max_state($code, "WARNING");
> +		} elsif (defined $resync{$k}) {
> +			$msg .= sprintf " %s status=%s,  resync=%s.",
> +				$devices{$k}, $status{$k}, $resync{$k};
> +			$code = max_state($code, "WARNING");
>  		} else {
>  			$msg .= sprintf " %s status=%s.", $devices{$k}, $status{$k};
>  			$code = max_state($code, "CRITICAL");
> 
> Maybe thats what you expecting?

This is also not correct, because the "resync" line might also have the
%-value and the finish= value.

Christoph
-------------- next part --------------
A non-text attachment was scrubbed...
Name: martin.vcf
Type: text/x-vcard
Size: 374 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-nagios-devel/attachments/20100329/c2479e9c/attachment.vcf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-nagios-devel/attachments/20100329/c2479e9c/attachment.pgp>


More information about the Pkg-nagios-devel mailing list