X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=dsa-nagios-checks%2Fchecks%2Fdsa-check-drbd;h=f23b950b73b8d6525be1ff6381b1528566414e8b;hb=f1b46d1fda452eb84a68c2b1124a060b43cbc84b;hp=5b062158309bc1fb04aebd99a73465b087584562;hpb=787fb63a9d485bcff11468b8b10edaa0df75b7de;p=mirror%2Fdsa-nagios.git diff --git a/dsa-nagios-checks/checks/dsa-check-drbd b/dsa-nagios-checks/checks/dsa-check-drbd index 5b06215..f23b950 100755 --- a/dsa-nagios-checks/checks/dsa-check-drbd +++ b/dsa-nagios-checks/checks/dsa-check-drbd @@ -4,6 +4,7 @@ # check_drbd v0.5.3 # # by Brandon Lee Poyner bpoyner / CCAC.edu # #################################################### +## 20151221 Peter Palfrader: add --ok-no-devices use strict; use File::Basename; @@ -13,6 +14,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 $ok_no_devices = 0; my $prog_name=basename($0); my $prog_revision='0.5.3'; @@ -86,7 +88,7 @@ my %state = ( sub print_usage { print <] [-e expect] [-p proc] [-r role] [-o states] [-w states] [-c states] [--debug] +Usage: $prog_name [-d ] [-e expect] [-p proc] [-r role] [-o states] [-w states] [-c states] [--debug] [--ok-no-devices] Options: -d STRING [default: $drbd_devices. Example: 0,1,2 ] -p STRING [default: $drbd_proc. Use '-' for stdin] @@ -137,6 +139,7 @@ sub parse_options { "o|ok=s" => \$ok_string, "w|warning=s" => \$warning_string, "c|critical=s" => \$critical_string, + "ok-no-devices" => \$ok_no_devices, "debug" => \$debug); if (defined($help) && ($help ne "")) { &print_help; @@ -266,7 +269,7 @@ sub parse_drbd_devices { $check{$device} = 1; } if (int(keys %check) == 0) { - &myexit('UNKNOWN',"No configured devices found"); + &myexit($ok_no_devices ? 'OK' : 'UNKNOWN',"No configured devices found"); } if (defined($debug_mode) && ($debug_mode == 1)) { #