[Pkg-nagios-changes] [pkg-nagios-plugins-contrib] 06/07: Move b04bdeb025c77e34fdf8ed9eab2f222240297ca3 into a patch file.
Bernd Zeimetz
bernd at bzed.de
Fri Apr 25 13:35:50 UTC 2014
This is an automated email from the git hooks/post-receive script.
bzed pushed a commit to branch master
in repository pkg-nagios-plugins-contrib.
commit f5deb224e7f7115d07046851552b8f74bbe3b768
Author: Bernd Zeimetz <bernd at bzed.de>
Date: Fri Apr 25 15:32:38 2014 +0200
Move b04bdeb025c77e34fdf8ed9eab2f222240297ca3 into a patch file.
---
check_drbd/check_drbd | 16 +-----
debian/patches/check_drbd/fix_for_oos_and_cosmetic | 64 ++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 68 insertions(+), 13 deletions(-)
diff --git a/check_drbd/check_drbd b/check_drbd/check_drbd
index 77d26e5..aeda397 100644
--- a/check_drbd/check_drbd
+++ b/check_drbd/check_drbd
@@ -12,7 +12,7 @@ use Getopt::Long;
my $drbd_proc='/proc/drbd';
my $drbd_devices=0;
my ($drbd_expect, $drbd_role, $drbd_version, $debug_mode);
-my (%options, %cs, %st, %ld, %ds, %oos, %check, %warning, %critical);
+my (%options, %cs, %st, %ld, %ds, %check, %warning, %critical);
my $prog_name=basename($0);
my $prog_revision='0.5.3';
@@ -210,17 +210,10 @@ sub parse_proc {
} else {
$input = "STDIN";
}
- my $devnum;
while(<$input>) {
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;
}
@@ -255,11 +248,11 @@ sub parse_drbd_devices {
#
my @devices;
if ($drbd_devices =~ /^all$/i) {
- for my $device ( sort keys %cs ) {
+ for my $device ( keys %cs ) {
push(@devices,$device);
}
} elsif ($drbd_devices =~ /^configured$/i) {
- for my $device ( sort keys %cs ) {
+ for my $device ( keys %cs ) {
next if ($cs{$device} eq "Unconfigured");
push(@devices,$device);
}
@@ -271,9 +264,6 @@ sub parse_drbd_devices {
&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} KiB");
- }
}
if (int(keys %check) == 0) {
&myexit('UNKNOWN',"No configured devices found");
diff --git a/debian/patches/check_drbd/fix_for_oos_and_cosmetic b/debian/patches/check_drbd/fix_for_oos_and_cosmetic
new file mode 100644
index 0000000..56bcf7f
--- /dev/null
+++ b/debian/patches/check_drbd/fix_for_oos_and_cosmetic
@@ -0,0 +1,64 @@
+commit b04bdeb025c77e34fdf8ed9eab2f222240297ca3
+Author: Stanislav German-Evtushenko <ginermail at gmail.com>
+Date: Mon Mar 3 08:11:31 2014 +0300
+
+ check_drbd: add check for oos and cosmetic
+
+ 1) add check for out of sync sectors (report WARNING for non-zero value)
+ 2) cosmetic: sort device list while processing
+
+diff --git a/check_drbd/check_drbd b/check_drbd/check_drbd
+index aeda397..45a4441 100644
+--- a/check_drbd/check_drbd
++++ b/check_drbd/check_drbd
+@@ -12,7 +12,7 @@ use Getopt::Long;
+ 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 @@ sub parse_proc {
+ } else {
+ $input = "STDIN";
+ }
++ my $devnum;
+ while(<$input>) {
+ 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 @@ sub parse_drbd_devices {
+ #
+ 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 @@ sub parse_drbd_devices {
+ &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");
diff --git a/debian/patches/series b/debian/patches/series
index f1bf613..3dc28f4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -30,3 +30,4 @@ check_cups/epn
check_webinject/epn
check_snmp_time/epn
check_varnish/automake_foreign
+debian/patches/check_drbd/fix_for_oos_and_cosmetic
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-nagios-plugins-contrib
More information about the Pkg-nagios-changes
mailing list