--- a/.hgtags Tue Jan 28 14:30:17 2014 +0100
+++ b/.hgtags Tue Jan 28 14:31:21 2014 +0100
@@ -1,1 +1,6 @@
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
--- a/MANIFEST Tue Jan 28 14:30:17 2014 +0100
+++ b/MANIFEST Tue Jan 28 14:31:21 2014 +0100
@@ -1,5 +1,12 @@
.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/debian/changelog Tue Jan 28 14:30:17 2014 +0100
+++ b/debian/changelog Tue Jan 28 14:31:21 2014 +0100
@@ -1,3 +1,39 @@
+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
--- a/debian/control Tue Jan 28 14:30:17 2014 +0100
+++ b/debian/control Tue Jan 28 14:31:21 2014 +0100
@@ -1,10 +1,13 @@
Source: nagios-plugin-amanda-client
Maintainer: Heiko Schlittermann <hs@schlittermann.de>
+Build-Depends: libtest-exception-perl
+Standards-Version: 3.9.4
+Section: misc
+Priority: optional
Package: nagios-plugin-amanda-client
-Section: misc
Architecture: any
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.
+ 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.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/copyright Tue Jan 28 14:31:21 2014 +0100
@@ -0,0 +1,1 @@
+/usr/share/common-licenses/GPL-3
--- a/plugins/check_amanda-client Tue Jan 28 14:30:17 2014 +0100
+++ b/plugins/check_amanda-client Tue Jan 28 14:31:21 2014 +0100
@@ -35,7 +35,15 @@
sub verbose;
sub unique { my %h; @h{@_} = (); keys %h }
-$SIG{__DIE__} = sub { UNKNOWN @_ unless $^S };
+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;
@@ -77,11 +85,8 @@
eval { amchecks @confs } or CRITICAL $@;
- my @dles = eval {
- compare_lists
- confs => \@confs,
- exclude => \@opt_exclude,
- }
+ my @dles =
+ eval { compare_lists confs => \@confs, exclude => \@opt_exclude, }
or CRITICAL $@;
OK 'config: ' . join(', ', @confs), @dles;
@@ -115,6 +120,10 @@
$) = "@groups";
verbose "su to $uid:$gid";
+
+ # during testing
+ return ($uid, $gid) if $ENV{HARNESS_ACTIVE};
+
setgid $gid;
setuid $uid;
}
@@ -191,13 +200,18 @@
my $conf = shift;
my $_ = qx(amdump_client --config '$conf' check 2>&1);
+
+ /^config:\s+
+ (BUSY Amanda is busy, retry later)/smx
+ and WARNING "$1\n";
+
/^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 die "unexpected output from check:\n$_";
+ /smx or UNKNOWN "unexpected output from check:\n$_";
}
sub amchecks {
--- a/t/00-basic.t Tue Jan 28 14:30:17 2014 +0100
+++ b/t/00-basic.t Tue Jan 28 14:31:21 2014 +0100
@@ -7,6 +7,7 @@
package FOO;
::require_ok 'blib/nagios/plugins/ius/check_amanda-client';
+FOO->import;
package main;
@@ -55,4 +56,8 @@
};
+subtest 'su' => sub {
+ is_deeply [FOO::su('root')], [0, 0], 'su to root';
+};
+
done_testing;