--- a/debian/control Thu Jan 23 22:58:26 2014 +0100
+++ b/debian/control Thu Jan 23 23:31:08 2014 +0100
@@ -4,7 +4,7 @@
Package: nagios-plugin-amanda-client
Section: misc
Architecture: any
-Depends: amanda-client (>= 3.0)
+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/plugins/check_amanda-client Thu Jan 23 22:58:26 2014 +0100
+++ b/plugins/check_amanda-client Thu Jan 23 23:31:08 2014 +0100
@@ -11,9 +11,14 @@
use File::Find;
use Carp;
use Pod::Usage;
+use Const::Fast;
our $VERSION = '0.0.2';
+const my $NAME => 'AMANDA-CLIENT';
+const my $USER => 'backup';
+const my $CFDIR => '/etc/amanda';
+
sub su;
sub find_tool;
sub check_perms;
@@ -25,8 +30,6 @@
sub main;
-my $NAME = 'AMANDA-CLIENT';
-
sub ok;
sub warning;
sub critical;
@@ -51,17 +54,9 @@
'v|verbose' => \$opt_verbose,
) or pod2usage;
- if ($opt_verbose) {
- *::verbose = sub { say '# ', @_ }
- }
- else {
- *::verbose = sub { }
- }
+ *::verbose = $opt_verbose ? sub { say '# ', @_ } : sub { };
# test needs to be run as root:* or as backup:backup
- my $USER = 'backup';
- my $CFDIR = '/etc/amanda';
-
# change to backup if still root
su $USER if $> == 0;