--- a/.hgignore Fri Jun 30 12:27:35 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-syntax:glob
-*.sw?
-_build/
-blib/
-Build
-*.bak
-MYMETA.*
-debian/nagios-plugin-amanda-client
-debian/debhelper.log
-debian/files
-debian/nagios-plugin-amanda-client.debhelper.log
-debian/nagios-plugin-amanda-client.substvars
-debian/substvars
--- a/.hgtags Fri Jun 30 12:27:35 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-8c9ba80ad7cb1505332604087bcb8129a96ae3fe nagios-plugin-amanda-client_0.0.2
-e30138360761c42e638f202d9a0ff6d719ec6e69 nagios-plugin-amanda-client_0.0.3
-a4e7a16b70dd91a3c5a1cdcae6e073ae9e3b70b1 nagios-plugin-amanda-client_0.0.4
-199351cb4fcba4d9822ca25eb3cc606ecb28d81b nagios-plugin-amanda-client_0.0.5
-8fb65fb08adf1c35d34ded93fcbe78169cf23597 nagios-plugin-amanda-client_0.0.6
-36f27c7a0f963321b3e537f249e12d3142fba4a6 nagios-plugin-amanda-client_0.0.7
-9b16171463ba6a2e8eec7a4990bf960b9d31db9b nagios-plugin-amanda-client_0.0.8
-a1cab33c4a51849120cc39b040e959eda42d42d1 nagios-plugin-amanda-client_0.0.9
-aa119a9f497a45bd2e609b1f478060aa8e9476d4 nagios-plugin-amanda-client_0.0.10
-d7530f92907d3900c88e8a0317fb91b98dd0b062 nagios-plugin-amanda-client_0.0.12
-c4eca9cae5d7cf48d626ceddaac76d02d546ebeb nagios-plugin-amanda-client_0.0.13
-11b8dc5a92e5d898c68a8ef90021c7d2d10e54d4 nagios-plugin-amanda-client_0.0.14
-c037c0bdd01aa30fc24d433c2ccfa776af5b8f49 nagios-plugin-amanda-client_0.0.15
-0c3ffc860b901132a9d77702ab337be854e797b1 nagios-plugin-amanda-client_0.0.16
--- a/.perltidyrc Fri Jun 30 12:27:35 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
---paren-tightness=2
---square-bracket-tightness=2
---nospace-for-semicolon
--- a/Build.PL Fri Jun 30 12:27:35 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-#! perl
-
-use 5.010;
-use strict;
-use warnings;
-use Module::Build;
-
-my $builder = Module::Build->new(
- dist_name => 'nagios-plugin-amanda-client',
- dist_version_from => 'plugins/check_amanda-client',
- dist_abstract => 'nagios check for amanda clients',
-
- # new type 'plugins'
- #
-
- # where to find the sources -> where to put them under blib
- checks_files => {
- 'plugins/check_amanda-client' =>
- 'nagios/plugins/ius/check_amanda-client',
- },
- etc_files => {
- 'etc/amanda-client.conf' => 'etc/amanda/README',
- },
- license => 'perl',
- requires => { perl => 5.014, 'Const::Fast' => 0.011 },
- build_requires => { 'Test::Exception' => 0, },
-);
-
-# some magic to install it to the proper location}
-if (not defined $builder->install_path('nagios')) {
- my $base = do {
- if ($builder->installdirs eq 'vendor') { '/usr/lib' }
- elsif (defined $builder->install_base) { $builder->install_base }
- else { '/usr/local/lib' }
- };
- $builder->install_path('nagios' => $base . '/nagios');
-}
-
-$builder->bindoc_dirs([@{ $builder->bindoc_dirs }, 'blib/nagios/plugins/ius']);
-$builder->add_build_element('checks');
-$builder->add_build_element('etc');
-
-$builder->create_build_script;
-
-__END__
-
--- a/MANIFEST Fri Jun 30 12:27:35 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-.hgignore
-.hgtags
-.perltidyrc
-Build.PL
-CHANGES
-MANIFEST This list of files
-plugins/check_amanda-client
-t/00-basic.t
-t/etc/amanda/DailySet1/amanda-client.conf
-t/etc/amanda/foo/amanda-client.conf
-t/etc/amanda/WeeklySet1/amanda-client.conf
-t/etc/no-amanda/.dir
--- a/MANIFEST.SKIP Fri Jun 30 12:27:35 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-
-#!start included /home/heiko/perl5/lib/perl5/ExtUtils/MANIFEST.SKIP
-# Avoid version control files.
-\bRCS\b
-\bCVS\b
-\bSCCS\b
-,v$
-\B\.svn\b
-\B\.git\b
-\B\.gitignore\b
-\b_darcs\b
-\B\.cvsignore$
-
-# Avoid VMS specific MakeMaker generated files
-\bDescrip.MMS$
-\bDESCRIP.MMS$
-\bdescrip.mms$
-
-# Avoid Makemaker generated and utility files.
-\bMANIFEST\.bak
-\bMakefile$
-\bblib/
-\bMakeMaker-\d
-\bpm_to_blib\.ts$
-\bpm_to_blib$
-\bblibdirs\.ts$ # 6.18 through 6.25 generated this
-
-# Avoid Module::Build generated and utility files.
-\bBuild$
-\b_build/
-\bBuild.bat$
-\bBuild.COM$
-\bBUILD.COM$
-\bbuild.com$
-
-# Avoid temp and backup files.
-~$
-\.old$
-\#$
-\b\.#
-\.bak$
-\.tmp$
-\.#
-\.rej$
-
-# Avoid OS-specific files/dirs
-# Mac OSX metadata
-\B\.DS_Store
-# Mac OSX SMB mount metadata files
-\B\._
-
-# Avoid Devel::Cover and Devel::CoverX::Covered files.
-\bcover_db\b
-\bcovered\b
-
-# Avoid MYMETA files
-^MYMETA\.
-#!end included /home/heiko/perl5/lib/perl5/ExtUtils/MANIFEST.SKIP
-
-# Avoid configuration metadata file
-^MYMETA\.
-
-# Avoid Module::Build generated and utility files.
-\bBuild$
-\bBuild.bat$
-\b_build
-\bBuild.COM$
-\bBUILD.COM$
-\bbuild.com$
-^MANIFEST\.SKIP
-
-# Avoid archives of this distribution
-\bnagios-plugin-amanda-client-[\d\.\_]+
-
-^\.hg\/
-^\..*sw.$
-^debian/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/README Tue Dec 03 13:35:42 2019 +0100
@@ -0,0 +1,1 @@
+moved to https://git.schlittermann.de/ius/nagios/nagios-plugin-amanda-client/
--- a/debian/changelog Fri Jun 30 12:27:35 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-nagios-plugin-amanda-client (0.0.16+nmu1) stable; urgency=medium
-
- * Non-maintainer upload.
- * Experimental feature lexical_topic has been removed from perl in version
- 5.23.4
- * build-depend on debhelper because it is required to build the package!
- * build-depend on libmodule-build-perl because it is no longer shipped with
- perl
- * build-depend on libconst-fast-perl because it is also required to build
- the package!
- * updated Standards-Version to satisfy lintian
-
- -- Matthias Förste <foerste@schlittermann.de> Fri, 30 Jun 2017 11:58:58 +0200
-
-nagios-plugin-amanda-client (0.0.16) stable; urgency=medium
-
- * fixed version check for experimental:
-
- -- Heiko Schlittermann (HS12-RIPE) <hs@schlittermann.de> Mon, 30 Mar 2015 14:08:45 +0200
-
-nagios-plugin-amanda-client (0.0.15) stable; urgency=medium
-
- * fixed experimental warnings
- * fixed dpkg-statoverride example
-
- -- Heiko Schlittermann (HS12-RIPE) <hs@schlittermann.de> Fri, 27 Mar 2015 15:47:49 +0100
-
-nagios-plugin-amanda-client (0.0.14) stable; urgency=low
-
- * reformatted Build.PL:
- * provide example conf, fix wrong man dir: The manpage went to
- /home/heiko/… that's wrong. And now we provide a README in
- /etc/amanda as a template for the configuration files
-
- -- Heiko Schlittermann (HS12-RIPE) <hs@schlittermann.de> Mon, 22 Dec 2014 20:17:13 +0100
-
-nagios-plugin-amanda-client (0.0.13) stable; urgency=low
-
- * just to bump the version number
-
- -- Heiko Schlittermann (HS12-RIPE) <hs@schlittermann.de> Mon, 22 Dec 2014 19:42:09 +0100
-
-nagios-plugin-amanda-client (0.0.12) stable; urgency=low
-
- * Non-maintainer upload.
- * fixed maintainer string: Added HS12
- * fixed again the maintainer string:
-
- -- Heiko Schlittermann (HS12-RIPE) <hs@schlittermann.de> Mon, 22 Dec 2014 19:41:07 +0100
-
-nagios-plugin-amanda-client (0.0.11) stable; urgency=low
-
- * fixed maintainer string: Added HS12
-
- -- Heiko Schlittermann (HS12) <hs@schlittermann.de> Tue, 15 Jul 2014 14:24:38 +0200
-
-nagios-plugin-amanda-client (0.0.10) stable; urgency=low
-
- * changed architecture to "all" (was "any"):
-
- -- Heiko Schlittermann <hs@schlittermann.de> Tue, 15 Jul 2014 14:11:25 +0200
-
-nagios-plugin-amanda-client (0.0.9) stable; urgency=low
-
- * small bugfix in suggested statoverride command:
- * fixed the exclusion list:
-
- -- Heiko Schlittermann <hs@schlittermann.de> Sat, 15 Feb 2014 23:14:22 +0100
-
-nagios-plugin-amanda-client (0.0.8) stable; urgency=low
-
- * Added test for sub su:
- * fixed the Build.PL for dependencies
- * Added better output to check_permissions
-
- -- Heiko Schlittermann <hs@schlittermann.de> Tue, 28 Jan 2014 14:32:41 +0100
-
-nagios-plugin-amanda-client (0.0.7) stable; urgency=low
-
- * Added the priority. Reformatted the description.:
-
- -- Heiko Schlittermann <hs@schlittermann.de> Tue, 28 Jan 2014 11:54:56 +0100
-
-nagios-plugin-amanda-client (0.0.6) stable; urgency=low
-
- * added section:
- * updated MANIFEST:
-
- -- Heiko Schlittermann <hs@schlittermann.de> Tue, 28 Jan 2014 11:50:02 +0100
-
-nagios-plugin-amanda-client (0.0.5) stable; urgency=low
-
- * added copyright
-
- -- Heiko Schlittermann <hs@schlittermann.de> Tue, 28 Jan 2014 11:40:21 +0100
-
-nagios-plugin-amanda-client (0.0.4) stable; urgency=low
-
- * added a warning if amanda is busy: It can happen that the amanda
- server is busy and can't answer the client requests for checking. We
- will consider this an an event being worth to warn about. It should
- go away after some more checks.
-
- -- Heiko Schlittermann <hs@schlittermann.de> Tue, 28 Jan 2014 11:21:53 +0100
-
-nagios-plugin-amanda-client (0.0.3) stable; urgency=low
-
- * testing added: I've added some testing. It can be a starting point.
- Currently is more ore less useless, I'm afraid. But you should get
- the point if you read the t/00-basic.t file.
-
- -- Heiko Schlittermann <hs@schlittermann.de> Sat, 25 Jan 2014 23:50:06 +0100
-
-nagios-plugin-amanda-client (0.0.2) stable; urgency=low
-
- * fixed install path and dependency on amanda-client
-
- -- Heiko Schlittermann <hs@schlittermann.de> Tue, 14 Jan 2014 16:49:15 +0100
-
-nagios-plugin-amanda-client (0.0.1) stable; urgency=low
-
- * Initial release.
-
- -- Heiko Schlittermann <hs@schlittermann.de> Tue, 14 Jan 2014 16:48:48 +0100
--- a/debian/compat Fri Jun 30 12:27:35 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-9
--- a/debian/control Fri Jun 30 12:27:35 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-Source: nagios-plugin-amanda-client
-Maintainer: Heiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
-Build-Depends: debhelper, libtest-exception-perl, libmodule-build-perl, libconst-fast-perl
-Standards-Version: 3.9.6
-Section: misc
-Priority: optional
-
-Package: nagios-plugin-amanda-client
-Architecture: all
-Depends: amanda-client (>= 3.0), libconst-fast-perl
-Description: nagios plugin do client side checks of the Amanda backup suite
- This is a nagios plugin. It checks triggers the Amanda client check for the
- current host and compares the DLE with the currenty mounted file systems.
--- a/debian/copyright Fri Jun 30 12:27:35 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-/usr/share/common-licenses/GPL-3
--- a/debian/dirs Fri Jun 30 12:27:35 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-/etc/amanda
--- a/debian/install Fri Jun 30 12:27:35 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-blib/etc/amanda/README etc/amanda
--- a/debian/rules Fri Jun 30 12:27:35 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#! /usr/bin/make -f
-
-PERL5LIB=
-PERL_MM_OPT=
-PERL_MB_OPT=
-
-%:
- @dh $@
--- a/etc/amanda-client.conf Fri Jun 30 12:27:35 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-# Copy this file to /etc/amanda/<config>
-# and complete and uncomment the lines
-#conf "<config>"
-#auth "bsdtcp"
-#tape-server "<server>"
-#index-server "<server>"
-#amdump-server "<server>"
--- a/plugins/check_amanda-client Fri Jun 30 12:27:35 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,374 +0,0 @@
-#! /usr/bin/perl
-# source: https://ssl.schlittermann.de/hg/ius/nagios/nagios-plugin-amanda-client
-
-use 5.014;
-use strict;
-use warnings;
-use Getopt::Long;
-use POSIX;
-use File::Spec::Functions;
-use Data::Dumper;
-use File::Find;
-use Carp;
-use Pod::Usage;
-use Const::Fast;
-use if $ENV{DEBUG} => 'Smart::Comments';
-use if $^V >= v5.18 => (experimental => qw/smartmatch/);
-
-const my $NAME => 'AMANDA-CLIENT';
-const my $USER => 'backup';
-const my $CFDIR => '/etc/amanda';
-
-sub su;
-sub find_tool;
-sub check_perms;
-sub config_names;
-sub get_devices;
-
-sub amchecks;
-sub compare_lists;
-
-sub main;
-
-sub OK;
-sub WARNING;
-sub CRITICAL;
-sub UNKNOWN;
-sub verbose;
-sub unique { my %h; @h{@_} = (); return keys %h }
-
-local $SIG{__DIE__} = sub { UNKNOWN @_ unless $^S };
-
-# this we need for testing only, if this file gets
-# included as a module
-sub import {
- no strict 'refs';
- *{"$_[0]::verbose"} = sub { };
-}
-
-
-exit main @ARGV if not caller;
-
-#----
-
-sub main {
- my @opt_exclude;
- my $opt_verbose = 0;
-
- GetOptions(
- 'e|x|exclude=s@' => \@opt_exclude,
- 'h|help' => sub { pod2usage(-verbose => 1, -exit => 0) },
- 'm|man' => sub { pod2usage(-verbose => 2, -exit => 0) },
- 'v|verbose' => \$opt_verbose,
- ) or pod2usage;
-
- *::verbose = $opt_verbose ? sub { say '# ', @_ } : sub { };
-
- verbose('setting working directory to /, this avoids permission problems');
- chdir '/';
-
- # test needs to be run as root:* or as backup:backup
- # change to backup if still root
- su $USER if $> == 0;
-
- # amservice needs to be suid root, but executable
- # by the backup user/group
- verbose q{checking permissions for `amservice'};
- eval { check_perms find_tool('amservice'), 04750, 'root', $) }
- or UNKNOWN $@;
-
- # find the backup sets we know about
- # here we suppose that it's possible to find strings like
- # 'conf "foo"' in files named 'amanda-client.conf' below /etc/amanda
-
- verbose qq{find config names from $CFDIR};
- my @confs = sort +unique eval { config_names $CFDIR }
- or UNKNOWN $@;
-
- eval { amchecks @confs } or CRITICAL $@;
-
- my @dles =
- eval { compare_lists confs => \@confs, exclude => \@opt_exclude, }
- or CRITICAL $@;
- OK 'config: ' . join(', ', @confs), @dles;
-
- # never reached
- return 0;
-}
-
-# compare the file systems
-# get a list of file system
-sub get_devices {
- open(my $fh, '/proc/filesystems');
- my @types = map { /^\s+(\S+)/ ? $1 : () } <$fh>;
- my @df = (df => '-P', map { -t => $_ } @types);
- map { [$_, (stat)[0]] } map { (split ' ', $_)[5] } grep { /^\// } `@df`;
-}
-
-sub su {
- my $user = shift;
- my $group = (getgrnam $user)[0];
- my $uid = getpwnam $user;
- my $gid = getgrnam $group;
-
- my @groups;
-
- setgrent;
- my @rc;
- while (my @g = getgrent) {
- push @groups, $g[2] if $user ~~ [split ' ', $g[3]];
- }
- endgrent;
- $) = "@groups";
-
- verbose "su to $uid:$gid";
-
- # during testing
- return ($uid, $gid) if $ENV{HARNESS_ACTIVE};
-
- setgid $gid;
- setuid $uid;
-}
-
-sub find_tool {
- my $name = shift;
- my @rc = grep { -f -x } map { catfile $_, $name } split /:/, $ENV{PATH}
- or die "Can't find executable `$name' in $ENV{PATH}\n";
- $rc[0];
-}
-
-sub check_perms {
- my ($file, $mode, $owner, $group) = @_;
-
- $owner = getpwuid $owner if $owner ~~ /^\d+$/;
-
- $group = getgrgid +(split ' ', $group)[0]
- if $group ~~ /^[\d\s]+$/;
-
- stat $file or croak "Can't stat `$file': $!\n";
-
- eval {
- my $f_owner = getpwuid +(stat _)[4] or die $!;
- my $f_group = getgrgid +(stat _)[5] or die $!;
- my $f_mode = (stat _)[2] & 07777 or die $!;
-
- my $msg =
- sprintf "need: 0%04o root:%s, got: 0%04o %s:%s\n",
- $mode, $group, $f_mode, $f_owner, $f_group;
-
- if (-f '/etc/debian_version') {
- $msg .= sprintf "try dpkg-statoverride --update --add root %s 0%04o %s\n",
- $group, $mode, $file;
- }
-
- die $msg unless $f_owner eq $owner;
- die $msg unless $f_group eq $group;
- die $msg unless $f_mode == $mode;
- };
- die "wrong permissions for `$file', $@" if $@;
- 1;
-}
-
-sub config_names {
- my $dir = shift;
- my @configs = ();
- find(
- sub {
- -f and /^amanda-client\.conf$/ or return;
- open(my $fh, '<', $_)
- or die "Can't open $File::Find::name: $!\n";
- push @configs, map { /^conf\s+"(.+?)"/ ? $1 : () } <$fh>;
- },
- $dir
- );
-
- die
-"no configs found below $dir (amanda-client.conf needs need `conf \"foo\"' line)\n"
- if not @configs;
- return @configs;
-}
-
-sub _amcheck {
-
- #config: daily
- #CHECKING
- #
- #Amanda Backup Client Hosts Check
- #--------------------------------
- #Client check: 1 host checked in 2.242 seconds. 0 problems found.
- #
- #(brought to you by Amanda 3.3.1)
- #The check is finished
-
- my $conf = shift;
- my $o = qx(amdump_client --config '$conf' check 2>&1);
-
- $o =~ /^config:\s+
- (BUSY Amanda is busy, retry later)/smx
- and WARNING "$1\n";
-
- $o =~ /^config:\s+$conf\n
- CHECKING\n
- .*\n
- Client.check:.1.host.checked.in.\d+\.\d+.seconds\.\s+0.problems.found\.\n
- .*\n
- The.check.is.finished$
- /smx or UNKNOWN "unexpected output from check:\n$o";
-}
-
-sub amchecks {
- my @errors = ();
- foreach my $conf (@_) {
- eval { _amcheck $conf } or push @errors, $@;
- }
- die @errors if @errors;
- return 1;
-}
-
-sub _amlist {
-
- # return a list of [ name, dev ] tupels.
- # name: the name of the disk/device
- # dev: the local device id (stat)[0]
- # iff the inum of $name != 2, it's not the top directory
- # and we set the device id to -1, since $name does not stand for a whole
- # device
- my $conf = shift;
- chomp((undef, my @dles) = qx(amdump_client --config '$conf' list));
- return map { [$_, (stat $_)[1] == 2 ? (stat $_)[0] : -1] } @dles;
-}
-
-sub compare_lists {
- my %arg = @_;
- my @confs = @{ $arg{confs} } or croak 'missing list of confs';
-
- # magic: if there is no config with the exclude, generate a list of config:exclude
- my @exclude = map { /^[^\/]+?:/ ? $_ : do { my $x = $_; map { "$_:$x" } @confs } }
- @{ $arg{exclude} };
- ### exclude:@exclude
-
- WARNING
- "excluded filesystem(s) @$_ does not exist, update the config please!\n"
- if @exclude
- and @$_ = grep { not -e } unique map { /^.*?:(.*)/ } @exclude;
-
- my @candidates = get_devices;
- my %missing;
-
- ### Candidates: @candidates
- foreach my $conf (@confs) {
- my @dles = _amlist $conf;
- ### DLEs: @dles
-
- foreach my $candidate (@candidates) {
- ### $candidate
- #next if not $candidate =~ m{^/|\Q$conf\E:};
-
- # we're satisfied if either the name of the device is in
- # 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]
- if not "$conf:$candidate->[0]" ~~ @exclude;
- }
- }
- die map { "$_ missing: " . join(', ' => @{ $missing{$_} }) . "\n" }
- keys %missing
- if %missing;
-
- return map { $_->[0] } @candidates;
-}
-
-sub OK { say "$NAME OK\n", join "\n" => @_; exit 0 }
-sub WARNING { print "$NAME WARNING\n", join "\n" => @_; exit 1 }
-sub CRITICAL { print "$NAME CRITICAL\n", join "\n" => @_; exit 2 }
-sub UNKNOWN { print "$NAME UNKNOWN\n", join "\n" => @_; exit 3 }
-
-1;
-
-__END__
-
-=pod
-
-=head1 NAME
-
- check_amanda-client - check the amanda backup from the client side
-
-=head1 SYNOPSIS
-
- check_amanda-client [-h|--help] [-m|--man]
- check_amanda-client [options]
-
-=head1 DESCRIPTION
-
-This nagios check plugin checks the Amanda setup from the client side.
-
-=head1 OPTIONS
-
-=over
-
-=item B<-x>|B<--exclude> [I<config:>]I<filesystem>
-
-The name of a filesystem to be excluded.
-No config means all configs.
-
- check_amanda-client --exclude weekly:/var/spool/squid --exclude /boot
-
-
-=item B<-h>|B<--help>
-
-Show a short description and help text.
-
-=item B<-m>|B<--man>
-
-Show the man page of this tool.
-
-=item B<-v>|B<--verbose>
-
-Show what's going only. Many for debugging purpose. (default: off)
-
-=back
-
-=head1 PREPARATIONS
-
-In order to make the check working, some preparations needs to be done.
-
-=head1 Client
-
-For each backup set you want to check: Create an
-F</etc/amanda/$set/amanda-client.conf>.
-
- config "foo"
- index-server "amanda.example.com" # used by restore
- tape-server "amanda.example.com" # used by restore
- amdump-server "amanda.example.com" # used by amdump_client
-
-In addition, the F<amservice> binary has to be suid root and executable
-by the backup user. This requirement is checked automatically by the
-plugin.
-
-=head1 Server
-
-The server need to know about the amdumpd service. In the F<inetd.conf>
-you need to add "amdumpd" to the list of allowed services. And
-additionally in F<.amandahosts> the "backup" user of the client needs
-the permissions to run the "amdumpd" service.
-
- # inetd.conf
- amanda stream tcp nowait backup /usr/lib/amanda/amandad amandad -auth=bsdtcp amindexd amidxtaped amdumpd
-
- # .amandahosts
- client.example.com backup amdumpd
- client.example.com root amindexd amidxtaped
-
-=head1 AUTHOR
-
-Heiko Schlittermann L<hs@schlittermann.de>
-
-=head1 SOURCE
-
-Source can be found at L<https://ssl.schlittermann.de/hg/nagios/nagios-plugin-amanda-client>
-
-=cut
-
-# vim:et ts=4 sw=4 aw ai:
--- a/t/00-basic.t Fri Jun 30 12:27:35 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-
-use 5.014;
-no strict 'subs';
-use Test::More;
-use Test::Exception;
-use English qw(-no_match_vars);
-
-package FOO;
-::require_ok 'blib/nagios/plugins/ius/check_amanda-client';
-FOO->import;
-
-package main;
-
-subtest 'find_tool' => sub {
- is FOO::find_tool('sh'), '/bin/sh' => 'found /bin/sh';
- dies_ok { FOO: find_tool('abc123xyz-unknown-tool') }
- 'dies for unknown tool';
-};
-
-subtest 'check_perms' => sub {
- my ($mode, $owner, $group) = (stat $EXECUTABLE_NAME)[2, 4, 5];
- $mode &= 07777;
-
- ok FOO::check_perms($EXECUTABLE_NAME, $mode, $owner, $group),
- "perms of $EXECUTABLE_NAME 1";
- ok FOO::check_perms(
- $EXECUTABLE_NAME, $mode,
- scalar(getpwuid $owner),
- scalar(getgrgid $group)
- ),
- "perms of $EXECUTABLE_NAME 2";
- dies_ok { FOO::check_perms($EXECUTABLE_NAME, $mode, $owner + 1, $group) }
- 'dies on wrong perms';
-};
-
-subtest 'config_names' => sub {
- is_deeply [sort +FOO::config_names('t/etc/amanda')],
- [sort qw(foobar DailySet1 WeeklySet1)] => 'got configs';
- dies_ok { FOO::config_names('t/etc/no-amanda') } 'dies on missing configs';
-};
-
-subtest 'file systems' => sub {
- my @fs = do {
- local @ARGV = ('/proc/filesystems');
- map { /(\S+)/ } grep { not /^nodev/ } <>;
- };
- my @devs =
- sort { $a->[0] cmp $b->[0] }
- map { [$_->[0], (stat $_->[0])[0]] }
- grep { $_->[1] ~~ @fs }
- map { [(split)[6, 1]] } `df -PT`;
- ok scalar @fs => 'have file systems for testing';
- ok scalar @devs => 'have devices for testing';
- is_deeply [sort { $a->[0] cmp $b->[0] } FOO::get_devices()],
- \@devs => 'got the proper devices';
-
-};
-
-subtest 'su' => sub {
- is_deeply [FOO::su('root')], [0, 0], 'su to root';
-};
-
-done_testing;
--- a/t/etc/amanda/DailySet1/amanda-client.conf Fri Jun 30 12:27:35 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-conf "DailySet1"
--- a/t/etc/amanda/WeeklySet1/amanda-client.conf Fri Jun 30 12:27:35 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-conf "WeeklySet1" # testing only
--- a/t/etc/amanda/foo/amanda-client.conf Fri Jun 30 12:27:35 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-conf "foobar"