# HG changeset patch # User Matthias Förste # Date 1407497697 -7200 # Node ID 9542011381cefd97ae1ad760448b9b3a0698e929 # Parent d2456e857a473f30bedef5e63142b16df0947e7a consider out of sync blocks critical diff -r d2456e857a47 -r 9542011381ce check_drbd.pl --- a/check_drbd.pl Thu Aug 25 16:50:49 2011 +0200 +++ b/check_drbd.pl Fri Aug 08 13:34:57 2014 +0200 @@ -62,16 +62,21 @@ open( FH, $file ) or print "$NAME CRITICAL: $file $!\n" and exit $ERRORS{CRITICAL}; + my $r; while () { chomp; -/^.*(?(?\d+):\s+cs:(?\S+)\s+(?:st|ro):(?\S+)\s+(?:ds|ld):(?\S+))/ - or next; - $drbd{ $+{resource} } = { - line => $+{line}, - connection_state => $+{connection_state}, - roles => $+{roles}, - disk_states => $+{disk_states} - }; + if (/^.*(?(?\d+):\s+cs:(?\S+)\s+(?:st|ro):(?\S+)\s+(?:ds|ld):(?\S+))/) { + $r = $+{resource}; + $drbd{$r} = { + line => $+{line}, + connection_state => $+{connection_state}, + roles => $+{roles}, + disk_states => $+{disk_states} + }; + } elsif (defined $r and /oos:(?\d+)/) { + $drbd{$r}->{out_of_sync} = $+{out_of_sync}; + $drbd{$r}->{line} .= " oos: $+{out_of_sync}"; + } } close(FH); @@ -89,6 +94,9 @@ if ( $dev->{disk_states} ne "UpToDate/UpToDate" ) and ( $dev->{disk_states} ne "Consistent" ); + $dev->{state} = "CRITICAL", next + if ( $dev->{out_of_sync} != 0 ); + $dev->{state} = "WARNING", next if $dev->{connection_state} ne "Connected";