# HG changeset patch # User Heiko Schlittermann # Date 1609971567 -3600 # Node ID 6a562a51e1d8e2e3aa0b1177cc8a9859f3b4716a # Parent a03a6dab11764209a1fedae288b4a389927e7737 Moved to git diff -r a03a6dab1176 -r 6a562a51e1d8 Makefile --- a/Makefile Fri Nov 03 11:18:53 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -SCRIPTS = check_release -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 a03a6dab1176 -r 6a562a51e1d8 README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Wed Jan 06 23:19:27 2021 +0100 @@ -0,0 +1,1 @@ +Moved to git.schlittermann.de/ius/nagios/nagios-plugin-release diff -r a03a6dab1176 -r 6a562a51e1d8 check_release.pl --- a/check_release.pl Fri Nov 03 11:18:53 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,207 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright (C) 2011 Christian Arnold -# Copyright (C) 2015 Heiko Schlittermann -# -# 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 strict; -use File::Basename; -use Getopt::Long; -use LWP::Simple; -use Pod::Usage; - -my %ERRORS = ( - OK => 0, - WARNING => 1, - CRITICAL => 2, - UNKNOWN => 3, - DEPENDENT => 4 -); - -sub get_local_release; -sub get_stable_release($$); -sub report($$); -sub version($$); - -my $ME = basename $0; -my $VERSION = "2.9"; - -my %opt = ( - url => "https://www.debian.org/releases/stable/index.html", - search => qr/

Debian\b.*?([\d.]+)/, - file => "/etc/debian_version", - ok => 0 -); - -MAIN: { - Getopt::Long::Configure('bundling'); - GetOptions( - "u|url=s" => \$opt{url}, - "s|search=s" => \$opt{search}, - "f|file=s" => \$opt{file}, - "o|ok" => \$opt{ok}, - "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 ($local_release, $stable_release) = eval { - get_local_release($opt{file}), - get_stable_release($opt{url}, $opt{search}); - }; - if ($@) { - print "RELEASE CRITICAL: $@\n"; - exit $ERRORS{CRITICAL}; - } - report($local_release, $stable_release); -} - -sub get_local_release { - - my $local_release = do { - local @ARGV = grep { -r } @_ - or die "@_: $!\n"; - <>; - }; - - chomp $local_release; - return $local_release; -} - -sub get_stable_release($$) { - my ($url, $search) = @_; - my $website; - - $website = get($url) - or die "Failed to get $url\n"; - - $website =~ /$opt{search}/s - or die "an't parse $url\n"; - - return $1; -} - -sub compare_versions { - my ($left, $right) = @_; - my @left = split '.', $left; - my @right = split '.', $right; - -} - -sub report($$) { - my ($local_release, $stable_release) = @_; - my ($local_major, $stable_major) = map { int } $local_release, $stable_release; - - - if ($opt{ok} or $local_release eq $stable_release or $local_major > $stable_major) { - print "RELEASE OK: $local_release/$stable_release\n"; - exit $ERRORS{OK}; - } - - if ($local_major - $stable_major < -1) { - print "RELEASE CRITICAL: $local_release / $stable_release\n"; - exit $ERRORS{CRITICAL}; - } - - print "RELEASE WARNING: $local_release / $stable_release\n"; - exit $ERRORS{"WARNING"}; - -} - -sub version($$) { - my ($progname, $version) = @_; - - print <<_VERSION; -$progname version $version -Copyright (C) 2011-2013 by Christian Arnold and Schlittermann internet & unix support. -Copyright (C) 2015 by 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_release - nagios plugin to checks the current debian release number - -=head1 SYNOPSIS - -check_release [-u|--url url] - [-s|--search string] - [-f|--file path] - [-o|--ok] - [-h|--help] - [-m|--man] - [-V|--version] - -=head1 OPTIONS - -=over - -=item B<-u>|B<--url> I - -URL where to search for the search string (default: https://www.debian.org/releases/stable/index.html) - -=item B<-s>|B<--search> I - -search string on the url (default: /

Debian\b.*?([\d.]+)/) - -=item B<-f>|B<--file> I - -file with current release informations (default: /etc/debian_version) - -=item B<-o>|B<--ok> - -Exit status always ok. - -=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 the current debian release number. - -=head1 VERSION - -This man page is current for version 2.3 of check_release. - -=head1 AUTHOR - -Written by Christian Arnold L - -=head1 COPYRIGHT - -Copyright (C) 2011 by Christian Arnold 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 a03a6dab1176 -r 6a562a51e1d8 debian/changelog --- a/debian/changelog Fri Nov 03 11:18:53 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -nagios-plugin-release (2.9+nmu2) oldstable stable; urgency=medium - - * docfix - - -- Matthias Förste Fri, 03 Nov 2017 11:14:38 +0100 - -nagios-plugin-release (2.9+nmu1~wheezy) wheezy; urgency=medium - - * we need a different build for wheezy because it seems that it can't deal - with the generated 'perl:any' dependency; this probably applies to older - older releases too - - -- Matthias Förste Fri, 03 Nov 2017 10:32:02 +0100 - -nagios-plugin-release (2.9+nmu1) oldstable stable; urgency=medium - - * Non-maintainer upload. - * fixed upstream url because at least one of the servers replies with 404 - * updated Version - - -- Matthias Förste Fri, 03 Nov 2017 09:40:22 +0100 - -nagios-plugin-release (2.9) oldstable stable; urgency=medium - - * changed logic: testing/unstable > stable: OK: - - -- Heiko Schlittermann (HS12-RIPE) Tue, 31 Mar 2015 09:18:40 +0200 - -nagios-plugin-release (2.7) oldstable stable; urgency=medium - - * fixed compression type: - - -- Heiko Schlittermann (HS12-RIPE) Wed, 28 Jan 2015 21:25:28 +0100 - -nagios-plugin-release (2.6) oldstable stable; urgency=medium - - * using gz instead of xz - - -- Heiko Schlittermann (HS12-RIPE) Wed, 28 Jan 2015 21:25:11 +0100 - -nagios-plugin-release (2.5) oldstable stable; urgency=medium - - * oldstable too - - -- Heiko Schlittermann (HS12-RIPE) Wed, 28 Jan 2015 21:10:41 +0100 - -nagios-plugin-release (2.4) stable; urgency=medium - - * Non-maintainer upload. - * * import to mercurial: - * * handling slowly update time for the debian website: - * splitting to more subroutines: adding pod documentation fixing - options parameters removing critical return status - * fixing problem in get_current_release function: adding debian - package dependency - * change to critical EXIT status if installed debian major version: - number is less then current available debian major version - * fixing a problem where failure to get the url may result in warning - status: - * added libwww-perl do build deps because syntax check during build - requires all used perl modules to be present; bumped package - version: - * fixing lintian errors and warnings: - * change to version 2.3: - * A third digit to the Release Number is no longer added, because the - release number currently consists of only two digits.: - - -- Heiko Schlittermann (HS12-RIPE) Wed, 28 Jan 2015 21:09:41 +0100 - -nagios-plugin-release (2.3+nmu1) stable; urgency=low - - * Non-maintainer upload. - * A third digit to the Release Number is no longer added, because the - release number consists of only two digits since wheezy - - -- Katharina Sommer Wed, 29 May 2013 15:01:18 +0200 - -nagios-plugin-release (2.3) stable; urgency=low - - * fixing lintian errors and warnings - - -- Christian Arnold Fri, 30 Sep 2011 14:59:21 +0200 - -nagios-plugin-release (2.2+nmu1) stable; urgency=low - - * Non-maintainer upload. - * fixing a problem where failure to get the url may result in warning status - * added libwww-perl do build deps because syntax check during build - requires all used perl modules to be present - - -- Matthias Förste Wed, 31 Aug 2011 15:55:09 +0200 - -nagios-plugin-release (2.2) stable; urgency=low - - * change to critical EXIT status if installed debian major version - number ist less then current available debian major version - - -- Christian Arnold Tue, 05 Jul 2011 15:00:12 +0200 - -nagios-plugin-release (2.1) stable; urgency=low - - * fixing problem in get_current_release function - - -- Christian Arnold Sun, 06 Feb 2011 15:33:00 +0100 - -nagios-plugin-release (2.0) stable; urgency=low - - * splitting to more subroutines - * adding pod documentation - * fixing options parameters - * removing critical return status - - -- Christian Arnold Sun, 06 Feb 2011 13:26:00 +0100 - -nagios-plugin-release (1.2-0) stable; urgency=low - - * handling slowly update time for the debian website - - -- Christian Arnold Mon, 06 Sep 2010 12:17:45 +0200 - -nagios-plugin-release (1.1-0) stable; urgency=low - - * fixing package dependencies (libwww-perl) - * return critical status if major number is lower than current stable major - number - * return warning status if minor number is unequal current stable minor - number - - -- Christian Arnold Thu, 15 Jul 2010 10:28:42 +0200 - -nagios-plugin-release (1.0-1) stable; urgency=low - - * Initial release - - -- Christian Arnold Fri, 09 Jul 2010 15:48:43 +0200 - diff -r a03a6dab1176 -r 6a562a51e1d8 debian/compat --- a/debian/compat Fri Nov 03 11:18:53 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -7 diff -r a03a6dab1176 -r 6a562a51e1d8 debian/control --- a/debian/control Fri Nov 03 11:18:53 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -Source: nagios-plugin-release -Section: net -Priority: extra -Maintainer: Heiko Schlittermann (HS12-RIPE) -Build-Depends: debhelper (>= 7), libwww-perl -Standards-Version: 3.9.1 - -Package: nagios-plugin-release -Architecture: all -Depends: ${misc:Depends}, ${perl:Depends}, libwww-perl -Description: nagios plugin to check current debian release number - This plugin checks the current debian release number. diff -r a03a6dab1176 -r 6a562a51e1d8 debian/copyright --- a/debian/copyright Fri Nov 03 11:18:53 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -It was downloaded from https://keller.schlittermann.de/hg/ius/nagios/nagios-plugin-release/ - -Upstream Author(s): - - Christian Arnold - -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 and -is licensed under the GPL, see above. diff -r a03a6dab1176 -r 6a562a51e1d8 debian/dirs --- a/debian/dirs Fri Nov 03 11:18:53 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -usr/bin -usr/sbin diff -r a03a6dab1176 -r 6a562a51e1d8 debian/docs diff -r a03a6dab1176 -r 6a562a51e1d8 debian/rules --- a/debian/rules Fri Nov 03 11:18:53 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +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 - -export PERL5LIB= -export PERL_MB_OPT= -export PERL_MM_OPT= - -%: - dh $@ - -override_dh_builddeb: - dh_builddeb -- -Zgzip