# HG changeset patch # User Matthias Förste # Date 1527173344 -7200 # Node ID 1f85ad1a7758bf1d1dcc4450d90f0c7dfd153ec9 # Parent 470e82d70ee0e3997f0b4134cc2ecbd048a64a90 moved to git diff -r 470e82d70ee0 -r 1f85ad1a7758 .hgignore --- a/.hgignore Fri Oct 10 16:45:44 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -syntax: glob -*.swp -debian/files -check_amanda - -syntax: regexp -(build|configure)-stamp$ -debian/nagios-plugin-amanda[./] diff -r 470e82d70ee0 -r 1f85ad1a7758 .perltitdy --- a/.perltitdy Fri Oct 10 16:45:44 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ ---paren-tightness=2 ---square-bracket-tightness=2 diff -r 470e82d70ee0 -r 1f85ad1a7758 Makefile --- a/Makefile Fri Oct 10 16:45:44 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -SCRIPTS = check_amanda -CLEANFILES = ${SCRIPTS} -DESTDIR = -prefix = /usr - -plugindir = ${prefix}/lib/nagios/plugins/ius - -.PHONY: all clean install - -all: ${SCRIPTS} - -clean: - -rm -f ${CLEANFILES} - -install: all - install -d -m 0755 ${DESTDIR}/${plugindir} - install -m 0755 $(SCRIPTS) ${DESTDIR}/${plugindir}/ - -%: %.pl - @perl -c $< - @cp -f $< $@ - @chmod +x $@ diff -r 470e82d70ee0 -r 1f85ad1a7758 README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Thu May 24 16:49:04 2018 +0200 @@ -0,0 +1,1 @@ +moved to git.schlittermann.de diff -r 470e82d70ee0 -r 1f85ad1a7758 check_amanda.pl --- a/check_amanda.pl Fri Oct 10 16:45:44 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -#! /usr/bin/perl - -# Copyright (C) 2011 Christian Arnold -# Copyright (C) 2014 Matthias Förste -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -# Christian Arnold - -use 5.010; -use strict; -use warnings; -use File::Basename qw(basename); -use Pod::Usage; -use Getopt::Long; -use Date::Manip; - -delete @ENV{ grep /^LC_/ => keys %ENV }; -$ENV{LANG} = "C"; -$ENV{LC_ALL} = "C"; - -sub version($$); -sub check_status($$); -sub report($$); - -my %ERRORS = ( - OK => 0, - WARNING => 1, - CRITICAL => 2, - UNKNOWN => 3, - DEPENDENT => 4 -); - -my $ME = basename $0; -my $NAME = 'AMANDA'; -my $VERSION = '1.3'; - -my %opt = ( - configfile => 'DailySet1', - time => '1day', - binary => '/usr/sbin/amstatus' -); - -MAIN: { - Getopt::Long::Configure('no_ignore_case_always'); - GetOptions( - "C|configfile=s" => \$opt{configfile}, - "t|time=s" => \$opt{time}, - "b|binary=s" => \$opt{binary}, - "h|help" => sub { pod2usage( -verbose => 1, -exitval => $ERRORS{OK} ) }, - "m|man" => sub { pod2usage( -verbose => 2, -exitval => $ERRORS{OK} ) }, - "V|version" => sub { version( $ME, $VERSION ); exit $ERRORS{OK}; } - ) or pod2usage( -verbose => 1, -exitval => $ERRORS{CRITICAL} ); - - my $time = Delta_Format($opt{time}, 0, "%sys"); - report 'CRITICAL', "Invalid --time" unless (defined $time and $time); - - unless ( -x $opt{binary} ) { - say "$NAME CRITICAL: $opt{binary} - not found or not executable"; - exit $ERRORS{CRITICAL}; - } - - my ( $rc, $date ) = check_status( $opt{configfile}, $time ); - report( $rc, $date ); - -} - -sub check_status($$) { - my ( $configfile, $time ) = @_; - my $last_backup_time; - my $mesg = undef; - my $rc = "CRITICAL"; - - foreach (`$opt{binary} --config $configfile --error`) { - /^Using / and next; - /^From\s+(.*)$/ and $last_backup_time = $1 and next; - /^\S+/ and return ('CRITICAL', 'some failed backups'); - } - - # check the backup time state - my $now = time; - my $last = Date_SecsSince1970GMT(UnixDate(ParseDate( $last_backup_time ), qw(%m %d %Y %H %M %S))); - return 'CRITICAL', "Last Backup too old: $last_backup_time" if $now - $last > $time; - return 'OK', $last_backup_time; - -} - -sub report($$) { - my ( $rc, $mesg ) = @_; - say "$NAME $rc: Backup ERROR $opt{configfile} - $mesg" - and exit $ERRORS{CRITICAL} - if ( $rc eq "CRITICAL" ); - say "$NAME $rc: Backup OK $opt{configfile} - $mesg"; - exit $ERRORS{OK}; -} - -sub version($$) { - my ( $progname, $version ) = @_; - say <<_VERSION; -$progname version $version -Copyright (C) 2011 by Christian Arnold and Schlittermann internet & unix support. - -$ME comes with ABSOLUTELY NO WARRANTY. This is free software, -and you are welcome to redistribute it under certain conditions. -See the GNU General Public Licence for details. -_VERSION -} - -__END__ - -=head1 NAME - -check_amanda - nagios plugin to checks the last amanda backup status - -=head1 SYNOPSIS - -check_amanda [B<-C>|B<--configfile> string] [B<-t>|B<--time> string] [B<-b>|B<--binary> string] - -check_amanda [B<-h>|B<--help>] - -check_amanda [B<-m>|B<--man>] - -check_amanda [B<-V>|B<--version>] - -=head1 OPTIONS - -=over - -=item B<-C>|B<--configfile> I - -The name of your amanda configuration (default: DailySet1) - -=item B<-t>|B<--time> I - -The maximum time difference from the current time (default: 1day) - -=item B<-b>|B<--binary> I - -Path to amstatus binary (default: /usr/sbin/amstatus) - -=item B<-h>|B<--help> - -Print detailed help screen. - -=item B<-m>|B<--man> - -Print manual page. - -=item B<-V>|B<--version> - -Print version information. - -=back - -=head1 DESCRIPTION - -This nagios plugin I on a specified I for a version string and compare the I result with an installed I version. - -=head1 VERSION - -This man page is current for version 1.3 of B. - -=head1 AUTHOR - -Written by Christian Arnold L and Matthias Förste L - -=head1 COPYRIGHT - -Copyright (C) 2011 by Christian Arnold, 2014 by Matthias Förste and Schlittermann internet & unix support. This is free software, and you are welcome to redistribute it under certain conditions. See the GNU General Public Licence for details. - -=cut diff -r 470e82d70ee0 -r 1f85ad1a7758 debian/changelog --- a/debian/changelog Fri Oct 10 16:45:44 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -nagios-plugin-amanda (1.3+nmu1) oldstable stable; urgency=low - - * Non-maintainer upload. - * better backup age calculation - * better error reporting when backup is too old - * author/copyright/download url updates - - -- Matthias Förste Fri, 10 Oct 2014 15:25:09 +0200 - -nagios-plugin-amanda (1.3) stable; urgency=low - - * fixing lintian errors and warnings - * added libdate-manip-perl, libdate-calc-perl to build deps - - -- Christian Arnold Fri, 30 Sep 2011 15:10:54 +0200 - -nagios-plugin-amanda (1.2+nmu1) squeeze; urgency=low - - * adapt to changed output format of amstatus (version 2.6.1p2) - * removed 'perl-base' from Depends (dont depend on packages with priority - 'essential') - * added (perl module) Depends to Build-Depends (Building performs a syntax - check on the source and thus requires used modules to be installed) - - -- Matthias Förste Fri, 05 Aug 2011 10:43:03 +0200 - -nagios-plugin-amanda (1.2) lenny squeeze; urgency=low - - * Initial Release. - - -- Christian Arnold Tue, 17 May 2011 09:42:50 +0200 diff -r 470e82d70ee0 -r 1f85ad1a7758 debian/compat --- a/debian/compat Fri Oct 10 16:45:44 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -7 diff -r 470e82d70ee0 -r 1f85ad1a7758 debian/control --- a/debian/control Fri Oct 10 16:45:44 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -Source: nagios-plugin-amanda -Section: net -Priority: extra -Maintainer: Christian Arnold -Build-Depends: debhelper (>= 7), libdate-manip-perl -Standards-Version: 3.9.4 -Homepage: https://keller.schlittermann.de/hg/ius/nagios/nagios-plugin-amanda - -Package: nagios-plugin-amanda -Architecture: all -Depends: ${perl:Depends}, ${misc:Depends}, perl-doc, libdate-manip-perl -Recommends: amanda-server -Description: nagios plugin to check amanda backup status - This plugin checks the last amanda backup status. diff -r 470e82d70ee0 -r 1f85ad1a7758 debian/copyright --- a/debian/copyright Fri Oct 10 16:45:44 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -It was downloaded from https://ssl.schlittermann.de/hg/ius/nagios/nagios-plugin-amanda/ - -Upstream Authors: - - Christian Arnold , Matthias Förste - -Copyright: - - - -License: - - This package is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This package is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this package; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -On Debian systems, the complete text of the GNU General -Public License can be found in `/usr/share/common-licenses/GPL'. - -The Debian packaging is (C) 2011, Christian Arnold , 2014, Matthias Förste and -is licensed under the GPL, see above. diff -r 470e82d70ee0 -r 1f85ad1a7758 debian/docs diff -r 470e82d70ee0 -r 1f85ad1a7758 debian/rules --- a/debian/rules Fri Oct 10 16:45:44 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -%: - dh $@ diff -r 470e82d70ee0 -r 1f85ad1a7758 debian/source/format --- a/debian/source/format Fri Oct 10 16:45:44 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -3.0 (native)