equal
deleted
inserted
replaced
77 my @confs = sort +unique eval { config_names $CFDIR } |
77 my @confs = sort +unique eval { config_names $CFDIR } |
78 or unknown $@; |
78 or unknown $@; |
79 |
79 |
80 eval { amchecks @confs } or critical $@; |
80 eval { amchecks @confs } or critical $@; |
81 |
81 |
82 my @dles = eval { amlists @confs } or critical $@; |
82 my @dles = eval { amlists confs => \@confs, ignore => \@opt_ignore } or critical $@; |
83 ok 'config: ' . join(', ', @confs), @dles; |
83 ok 'config: ' . join(', ', @confs), @dles; |
84 |
84 |
85 # never reached |
85 # never reached |
86 return 0; |
86 return 0; |
87 } |
87 } |
212 chomp((undef, my @dles) = qx(amdump_client --config '$conf' list)); |
212 chomp((undef, my @dles) = qx(amdump_client --config '$conf' list)); |
213 return map { [$_, (stat $_)[1] == 2 ? (stat $_)[0] : -1] } @dles; |
213 return map { [$_, (stat $_)[1] == 2 ? (stat $_)[0] : -1] } @dles; |
214 } |
214 } |
215 |
215 |
216 sub amlists { |
216 sub amlists { |
217 my @confs = @_; |
217 my %arg = @_; |
|
218 my @confs = @{$arg{confs}} or croak 'missing list of confs'; |
|
219 my @ignore = @{$arg{ignore}}; |
|
220 |
218 my @candidates = get_devices; |
221 my @candidates = get_devices; |
219 |
222 |
220 my %missing; |
223 my %missing; |
221 |
224 |
222 foreach my $conf (@confs) { |
225 foreach my $conf (@confs) { |
225 |
228 |
226 # we're satisfied if either the name of the device is in |
229 # we're satisfied if either the name of the device is in |
227 # the disklist, or the device id is found |
230 # the disklist, or the device id is found |
228 $candidate->[0] ~~ [map { $_->[0] } @dles] and next; |
231 $candidate->[0] ~~ [map { $_->[0] } @dles] and next; |
229 $candidate->[1] ~~ [map { $_->[1] } @dles] and next; |
232 $candidate->[1] ~~ [map { $_->[1] } @dles] and next; |
230 push @{ $missing{$conf} }, $candidate->[0]; |
233 push @{ $missing{$conf} }, $candidate->[0] |
|
234 if not "$conf:$candidate->[0]" ~~ @ignore; |
231 } |
235 } |
232 } |
236 } |
233 die map { "$_ missing: " . join(', ' => @{ $missing{$_} }) . "\n" } |
237 die map { "$_ missing: " . join(', ' => @{ $missing{$_} }) . "\n" } |
234 keys %missing |
238 keys %missing |
235 if %missing; |
239 if %missing; |
248 check_amanda-client - check the amanda backup from the client side |
252 check_amanda-client - check the amanda backup from the client side |
249 |
253 |
250 =head1 SYNOPSIS |
254 =head1 SYNOPSIS |
251 |
255 |
252 check_amanda-client [-h|--help] [-m|--man] |
256 check_amanda-client [-h|--help] [-m|--man] |
|
257 check_amanda-client [options] |
253 |
258 |
254 =head1 DESCRIPTION |
259 =head1 DESCRIPTION |
255 |
260 |
256 This nagios check plugin checks the Amanda setup from the client side. |
261 This nagios check plugin checks the Amanda setup from the client side. |
257 |
262 |
258 =head1 OPTIONS |
263 =head1 OPTIONS |
259 |
264 |
260 =over |
265 =over |
261 |
266 |
262 =item B<-i>|B<--ignore> I<filesystem> |
267 =item B<-i>|B<--ignore> I<config:filesystem> |
263 |
268 |
264 The name of a filesystem to be ignored. |
269 The name of a filesystem to be ignored. Example: |
|
270 |
|
271 check_amanda-client --ignore weekly:/var/spool/squid --ignore daily:/boot |
265 |
272 |
266 =item B<-h>|B<--help> |
273 =item B<-h>|B<--help> |
267 |
274 |
268 Show a short description and help text. |
275 Show a short description and help text. |
269 |
276 |