--- a/Makefile Tue Feb 27 17:03:05 2018 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-SCRIPTS = check_rsnapshot
-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 $@
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/README Thu Dec 12 16:01:50 2019 +0100
@@ -0,0 +1,1 @@
+Moved to git!
--- a/check_rsnapshot.pl Tue Feb 27 17:03:05 2018 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,247 +0,0 @@
-#! /usr/bin/perl -w
-
-# Copyright (C) 2011-2013 Christian Arnold
-# Copyright (C) 2013-2018 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 <http://www.gnu.org/licenses/>.
-#
-# Christian Arnold <arnold@schlittermann.de>, Matthias Förste <foerste@schlittermann.de>
-
-=encoding utf8
-=cut
-
-use strict;
-use File::Basename;
-use Getopt::Long;
-use Compress::Zlib;
-use Date::Manip;
-use Pod::Usage;
-use if $ENV{DEBUG} => "Smart::Comments";
-
-my %ERRORS = (
- OK => 0,
- WARNING => 1,
- CRITICAL => 2,
- UNKNOWN => 3,
- DEPENDENT => 4
-);
-
-sub get_status($$$);
-sub report($);
-sub version($$);
-
-my $ME = basename $0;
-my $VERSION = "2.10.1";
-
-my %opt = (
- binary => "/usr/bin/rsnapshot",
- maxage => undef,
- date => "today"
-);
-
-MAIN: {
- Getopt::Long::Configure('bundling');
- GetOptions(
- "b|binary=s" => \$opt{binary},
- "s|maxage=i" => \$opt{maxage},
- "d|date=s" => \$opt{date},
- "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 @logfiles = @ARGV ? @ARGV : glob '/var/log/rsnapshot.log{,.1.gz}';
-
- # older versions log the date as %d/%b/%Y
- my $date = UnixDate(ParseDate($opt{date}), "(%d/%b/%Y|%Y-%m-%d)");
- unless ($date) {
- print "RSNAPSHOT CRITICAL: can't parse date [$opt{date}]\n";
- exit $ERRORS{CRITICAL};
- }
-
- my $maxage =
- defined $opt{maxage}
- ? time - $opt{maxage}
- : UnixDate(ParseDate($opt{date}), "%s");
-
- unless (defined $maxage) {
- print
- "RSNAPSHOT CRITICAL: undefined log file max age; this should not happen\n";
- exit $ERRORS{CRITICAL};
- }
-
- unless (-x $opt{binary}) {
- print
- "RSNAPSHOT CRITICAL: binary '$opt{binary}' - not found or not executable\n";
- exit $ERRORS{CRITICAL};
- }
-
- my $status = get_status([@logfiles], $date, $maxage);
- report($status);
-}
-
-sub get_status($$$) {
-
- my ($logfiles, $date, $maxage) = @_;
- my ($error, $found_in_file);
-
- for my $logfile (@{$logfiles}) {
-
- unless (-e $logfile) {
- print "RSNAPSHOT CRITICAL: logfile '$logfile' - don't exists\n";
- exit $ERRORS{CRITICAL};
- }
-
- next if (stat $logfile)[9] < $maxage;
-
- if ($logfile =~ /\.gz$/) {
- my $gz = gzopen($logfile, "rb")
- or print "RSNAPSHOT CRITICAL: Cannot open $logfile: $gzerrno\n"
- and exit $ERRORS{CRITICAL};
- while ($gz->gzreadline($_) > 0) {
- next unless (/^\[$date/);
- $found_in_file = $logfile;
- if (/^\[$date:.*ERROR/) {
- $error = $_;
- last;
- }
- }
- print "RSNAPSHOT CRITICAL: Error reading from $logfile: $gzerrno\n"
- and exit $ERRORS{CRITICAL}
- if $gzerrno != Z_STREAM_END;
- $gz->gzclose();
- } else {
- open(FH, $logfile)
- or print "RSNAPSHOT CRITICAL: $logfile - $!\n"
- and exit $ERRORS{CRITICAL};
- while (<FH>) {
- next unless (/^\[$date/);
- $found_in_file = $logfile;
- if (/^\[$date:.*ERROR/) {
- $error = $_;
- last;
- }
- }
- close(FH);
- }
-
- last if $found_in_file;
-
- }
-
- $error |= "can't find rsnapshot run from [$date]\n" unless ($found_in_file);
-
- if ($error) {
- print "RSNAPSHOT CRITICAL: $error";
- exit $ERRORS{CRITICAL};
- } else {
- print "RSNAPSHOT OK: no errors in $found_in_file\n";
- exit $ERRORS{OK};
- }
-}
-
-sub version($$) {
- my $progname = shift;
- my $version = shift;
-
- print <<_VERSION;
-$progname version $version
-Copyright (C) 2011-2013 by Christian Arnold and Schlittermann internet & unix
-support.
-
-Copyright (C) 2013-2018 by Matthias Förste 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
-}
-
-=head1 NAME
-
-check_rsnapshot - nagios plugin to check for errors on rsnapshot logfile
-
-=head1 SYNOPSIS
-
-check_release [-b|--binary string]
- [-s|--maxage integer]
- [-d|--date string]
- [-h|--help]
- [-m|--man]
- [-V|--version]
- [logfile1 logfile2 ..]
-
-=head1 OPTIONS
-
-=over
-
-=item B<-b>|B<--binary> I<string>
-
-rsnapshot binary (default: /usr/bin/rsnapshot)
-
-=item B<-s>|B<--maxage> I<integer>
-
-Files modified more than B<--maxage> seconds ago will be silently ignored.
-(default: same as B<--date>)
-
-=item B<-d>|B<--date> I<string>
-
-Parse date for rsnapshot logfile. (default: today)
-
-Note: this defaulted to 'yesterday' earlier to avoid the situation that the
-check goes critical while rsnapshot is still running. I think the nagios check
-should either be scheduled later or the check should indeed check for the run
-from yesterday if a later schedule is not desirable for some reason in that
-case. But that should B<not> be the default.
-
-=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 plugin checks rsnapshot logfile for errors.
-
-=head1 EXAMPLES
-
-check_rsnapshot -s 172800 -d "2 days ago" /var/log/rsnapshot/rsnapshot.log
-
-=head1 VERSION
-
-This man page is current for version 2.8 of check_rsnapshot.
-
-=head1 AUTHORS
-
-2011-2013 Originally written by Christian Arnold L<arnold@schlittermann.de>.
-
-2013-2018 Maintained by Matthias Förste L<foerste@schlittermann.de>.
-
-=head1 COPYRIGHT
-
-Copyright (C) 2011-2013 by Christian Arnold and Schlittermann internet & unix
-support. Copyright (C) 2013-2018 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
--- a/debian/changelog Tue Feb 27 17:03:05 2018 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-nagios-plugin-rsnapshot (2.10.1) oldstable stable; urgency=medium
-
- * bugfix
-
- -- Matthias Förste <foerste@schlittermann.de> Tue, 27 Feb 2018 10:31:06 +0100
-
-nagios-plugin-rsnapshot (2.10) oldstable stable; urgency=medium
-
- * newer rsnapshot versions log the date in a different format
-
- -- Matthias Förste <foerste@schlittermann.de> Tue, 13 Feb 2018 13:08:00 +0100
-
-nagios-plugin-rsnapshot (2.9.1) oldstable stable; urgency=low
-
- * fixed lintian error: helper-templates-in-copyright
- * [bumped Standards-Version] (fixes lintian warning:
- out-of-date-standards-version)
-
- -- Matthias Förste <foerste@schlittermann.de> Thu, 12 Dec 2013 16:33:12 +0100
-
-nagios-plugin-rsnapshot (2.9) oldstable stable; urgency=low
-
- * new release
- * check run of today by default now
-
- -- Matthias Förste <foerste@schlittermann.de> Thu, 12 Dec 2013 12:36:48 +0100
-
-nagios-plugin-rsnapshot (2.8) oldstable stable; urgency=low
-
- * new release
-
- -- Matthias Förste <foerste@schlittermann.de> Tue, 02 Apr 2013 10:49:27 +0200
-
-nagios-plugin-rsnapshot (2.7) oldstable stable; urgency=low
-
- * bugfix: report actual error instead of "can't find rsnapshot run"
-
- -- Matthias Förste <foerste@schlittermann.de> Tue, 26 Mar 2013 11:33:00 +0100
-
-nagios-plugin-rsnapshot (2.6) oldstable stable; urgency=low
-
- * support checking of multiple logfiles; renamed "--seconds" to "--maxage";
- changed semantics for "--seconds"/"--maxage"
- * author/maintainer/copyright update
-
- +Build-Depends: libdate-manip-perl (perl syntax check in Makefile fails
- otherwise)
-
- -- Matthias Förste <foerste@schlittermann.de> Mon, 04 Mar 2013 17:00:23 +0100
-
-nagios-plugin-rsnapshot (2.5) oldstable stable; urgency=low
-
- [this version conflicts with an uncommitted release]
-
- -- Matthias Förste <foerste@schlittermann.de> Mon, 04 Mar 2013 16:48:28 +0100
-
-nagios-plugin-rsnapshot (2.4) stable; urgency=low
-
- * fixed logrotate problem
-
- -- Christian Arnold <arnold@schlittermann.de> Wed, 02 Nov 2011 16:01:02 +0100
-
-nagios-plugin-rsnapshot (2.3) stable; urgency=low
-
- * fixed logrotate problem
-
- -- Christian Arnold <arnold@schlittermann.de> Tue, 01 Nov 2011 15:00:48 +0100
-
-nagios-plugin-rsnapshot (2.2) lenny squeeze; urgency=low
-
- * add version function
-
- -- Christian Arnold <arnold@schlittermann.de> Wed, 15 Jun 2011 13:38:24 +0200
-
-nagios-plugin-rsnapshot (2.1) lenny squeeze; urgency=low
-
- * intercept of possible mistakes
-
- -- Christian Arnold <arnold@schlittermann.de> Tue, 14 Jun 2011 12:10:02 +0200
-
-nagios-plugin-rsnapshot (2.0) stable; urgency=low
-
- * now new code style
-
- -- Christian Arnold <arnold@schlittermann.de> Fri, 04 Mar 2011 15:05:45 +0100
-
-nagios-plugin-rsnapshot (1.0-1) stable; urgency=low
-
- * Initial release
-
- -- Christian Arnold <arnold@schlittermann.de> Tue, 11 Nov 2008 10:49:16 +0100
-
--- a/debian/compat Tue Feb 27 17:03:05 2018 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-9
--- a/debian/control Tue Feb 27 17:03:05 2018 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-Source: nagios-plugin-rsnapshot
-Section: net
-Priority: extra
-Maintainer: Matthias Förste <foerste@schlittermann.de>
-Build-Depends: debhelper (>= 7), libdate-manip-perl
-Standards-Version: 3.9.8
-
-Package: nagios-plugin-rsnapshot
-Architecture: all
-Depends: ${misc:Depends}, ${perl:Depends}, perl-doc, libdate-manip-perl
-Suggests: libsmart-comments-perl
-Description: nagios plugin to check rsnapshot
- This is a nagios plugin to check rsnapshot logfile.
--- a/debian/copyright Tue Feb 27 17:03:05 2018 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-It was downloaded from https://keller.schlittermann.de/hg/ius/nagios/nagios-plugin-rsnapshot/
-
-Upstream Authors:
-
- Christian Arnold <arnold@schlittermann.de>, Matthias Förste <foerste@schlittermann.de>
-
-Copyright:
-
- <Copyright (C) 2011-2013 Schlittermann internet & unix support>
-
-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-2013, Christian Arnold
-<arnold@schlittermann.de> and is licensed under the GPL, see above.
-
-The Debian packaging is (C) 2013, Matthias Förste <foerste@schlittermann.de>
-and is licensed under the GPL, see above.
--- a/debian/rules Tue Feb 27 17:03:05 2018 +0100
+++ /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 $@