# check_drbd v0.5.3 #
# by Brandon Lee Poyner bpoyner / CCAC.edu #
####################################################
+## 20151221 Peter Palfrader: add --ok-no-devices
use strict;
use File::Basename;
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';
sub print_usage {
print <<EOF
-Usage: $prog_name [-d <All|Configured|...>] [-e expect] [-p proc] [-r role] [-o states] [-w states] [-c states] [--debug]
+Usage: $prog_name [-d <All|Configured|...>] [-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]
"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;
$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)) {
#