--- a/check Sat Jan 11 17:20:05 2014 +0100
+++ b/check Sat Jan 11 23:23:59 2014 +0100
@@ -36,21 +36,25 @@
exit main @ARGV;
-
#----
sub main {
+ my @opt_ignore;
my $opt_verbose = 0;
GetOptions(
- 'h|help' => sub { pod2usage(-verbose => 1, -exit => 0) },
- 'm|man' => sub { pod2usage(-verbose => 2, -exit => 0) },
- 'v|verbose' => \$opt_verbose,
+ 'i|ignore=s@' => \@opt_ignore,
+ 'h|help' => sub { pod2usage(-verbose => 1, -exit => 0) },
+ 'm|man' => sub { pod2usage(-verbose => 2, -exit => 0) },
+ 'v|verbose' => \$opt_verbose,
) or pod2usage;
- if ($opt_verbose) { *::verbose = sub { say '# ', @_ } }
- else { *::verbose = sub { } }
-
+ if ($opt_verbose) {
+ *::verbose = sub { say '# ', @_ }
+ }
+ else {
+ *::verbose = sub { }
+ }
# test needs to be run as root:* or as backup:backup
my $USER = 'backup';
@@ -75,8 +79,8 @@
eval { amchecks @confs } or critical $@;
- my @dles = eval { amlists @confs } or critical $@;
- ok 'config: ' .join(', ', @confs), @dles;
+ my @dles = eval { amlists confs => \@confs, ignore => \@opt_ignore } or critical $@;
+ ok 'config: ' . join(', ', @confs), @dles;
# never reached
return 0;
@@ -210,7 +214,10 @@
}
sub amlists {
- my @confs = @_;
+ my %arg = @_;
+ my @confs = @{$arg{confs}} or croak 'missing list of confs';
+ my @ignore = @{$arg{ignore}};
+
my @candidates = get_devices;
my %missing;
@@ -223,7 +230,8 @@
# the disklist, or the device id is found
$candidate->[0] ~~ [map { $_->[0] } @dles] and next;
$candidate->[1] ~~ [map { $_->[1] } @dles] and next;
- push @{ $missing{$conf} }, $candidate->[0];
+ push @{ $missing{$conf} }, $candidate->[0]
+ if not "$conf:$candidate->[0]" ~~ @ignore;
}
}
die map { "$_ missing: " . join(', ' => @{ $missing{$_} }) . "\n" }
@@ -246,6 +254,7 @@
=head1 SYNOPSIS
check_amanda-client [-h|--help] [-m|--man]
+ check_amanda-client [options]
=head1 DESCRIPTION
@@ -255,6 +264,12 @@
=over
+=item B<-i>|B<--ignore> I<config:filesystem>
+
+The name of a filesystem to be ignored. Example:
+
+ check_amanda-client --ignore weekly:/var/spool/squid --ignore daily:/boot
+
=item B<-h>|B<--help>
Show a short description and help text.