Build precise queries to find exactly what you need
Press ESC to close
Nagios World Conference 2026: Sept. 14-17 in St. Paul, MN | Learn More
— /tmp/check_drbd.orig 2014-03-03 01:35:53.000000000 +0400 +++ check_drbd 2014-03-03 08:54:59.897998487 +0400 @@ -12,7 +12,7 @@ my $drbd_proc=’/proc/drbd’; my $drbd_devices=0; my ($drbd_expect, $drbd_role, $drbd_version, $debug_mode); -my (%options, %cs, %st, %ld, %ds, %check, %warning, %critical); +my (%options, %cs, %st, %ld, %ds, %oos, %check, %warning, %critical);
my $prog_name=basename($0); my $prog_revision=’0.5.3′; @@ -210,10 +210,17 @@ } else { $input = “STDIN”; } + my $devnum; while() { if (/^version: (d+).(d+)/) { $drbd_version = “$1.$2”; } + if (/^s?(d+):.*/) { + $devnum = $1; + } + if (defined($devnum) and /soos:(d+)/) { + $oos{$devnum} = $1; + } if (/^s?(d+):.* cs:(w+)/) { $cs{$1} = $2; } @@ -248,11 +255,11 @@ # my @devices; if ($drbd_devices =~ /^all$/i) { – for my $device ( keys %cs ) { + for my $device ( sort keys %cs ) { push(@devices,$device); } } elsif ($drbd_devices =~ /^configured$/i) { – for my $device ( keys %cs ) { + for my $device ( sort keys %cs ) { next if ($cs{$device} eq “Unconfigured”); push(@devices,$device); } @@ -264,6 +271,9 @@ &myexit(‘UNKNOWN’,”Could not find device $device”); } $check{$device} = 1; + if (defined($oos{$device}) and $oos{$device} > 0) { + &myexit(‘WARNING’,”Out of sync on device $device: $oos{$device} sectors”); + } } if (int(keys %check) == 0) { &myexit(‘UNKNOWN’,”No configured devices found”);