--- a/plugins/check_amanda-client Sat Jan 11 23:54:53 2014 +0100
+++ b/plugins/check_amanda-client Mon Jan 13 23:10:49 2014 +0100
@@ -21,7 +21,7 @@
sub get_devices;
sub amchecks;
-sub amlists;
+sub compare_lists;
sub main;
@@ -81,7 +81,7 @@
eval { amchecks @confs } or critical $@;
- my @dles = eval { amlists confs => \@confs, ignore => \@opt_ignore } or critical $@;
+ my @dles = eval { compare_lists confs => \@confs, ignore => \@opt_ignore } or critical $@;
ok 'config: ' . join(', ', @confs), @dles;
# never reached
@@ -215,13 +215,15 @@
return map { [$_, (stat $_)[1] == 2 ? (stat $_)[0] : -1] } @dles;
}
-sub amlists {
+sub compare_lists {
my %arg = @_;
my @confs = @{$arg{confs}} or croak 'missing list of confs';
my @ignore = @{$arg{ignore}};
+ warning "ignored filesystem(s) @$_ does not exist, update the config please!\n"
+ if @ignore and @$_ = grep { not -e } unique map { /^.*?:(.*)/ } @ignore;
+
my @candidates = get_devices;
-
my %missing;
foreach my $conf (@confs) {
@@ -239,6 +241,7 @@
die map { "$_ missing: " . join(', ' => @{ $missing{$_} }) . "\n" }
keys %missing
if %missing;
+
return map { $_->[0] } @candidates;
}