renamed; added missing build dep; fixed some lintian warnings default tip
authorMatthias Förste <foerste@schlittermann.de>
Tue, 20 Jan 2015 15:32:41 +0100
changeset 9 8bec5bd2e6b2
parent 8 2d2de8fa5d70
renamed; added missing build dep; fixed some lintian warnings
.hgignore
Makefile
check_zarafa.pl
check_zarafa_version.pl
debian/changelog
debian/control
debian/copyright
--- a/.hgignore	Tue Apr 17 10:14:59 2012 +0200
+++ b/.hgignore	Tue Jan 20 15:32:41 2015 +0100
@@ -1,8 +1,8 @@
 syntax: glob
 *.swp
 debian/files
-check_zarafa
+check_zarafa_version
 
 syntax: regexp
 (build|configure)-stamp$
-debian/nagios-plugin-zarafa[./]
+debian/nagios-plugin-zarafa-version[./]
--- a/Makefile	Tue Apr 17 10:14:59 2012 +0200
+++ b/Makefile	Tue Jan 20 15:32:41 2015 +0100
@@ -1,4 +1,4 @@
-SCRIPTS = check_zarafa
+SCRIPTS = check_zarafa_version
 CLEANFILES = ${SCRIPTS}
 DESTDIR =
 prefix = /usr
--- a/check_zarafa.pl	Tue Apr 17 10:14:59 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,194 +0,0 @@
-#! /usr/bin/perl
-
-#   Copyright (C) 2011  Christian Arnold
-#
-#   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>
-
-use 5.010;
-use strict;
-use warnings;
-use File::Basename qw(basename);
-use Pod::Usage;
-use Getopt::Long;
-use LWP::Simple;
-
-delete @ENV{ grep /^LC_/ => keys %ENV };
-$ENV{LANG}   = "C";
-$ENV{LC_ALL} = "C";
-
-sub version($$);
-sub get_last_version($$);
-sub get_current_version($);
-sub report($$);
-
-my %ERRORS = (
-    OK        => 0,
-    WARNING   => 1,
-    CRITICAL  => 2,
-    UNKNOWN   => 3,
-    DEPENDENT => 4
-);
-
-my $ME      = basename $0;
-my $NAME    = 'ZARAFA';
-my $VERSION = '0.3';
-
-my %opt = (
-    url     => 'http://www.zarafa.com/download-release',
-    search  => 'http://download.zarafa.com/community/final/[\d\.]+/([\d\.-]+)',
-    package => 'zarafa'
-);
-
-MAIN: {
-    Getopt::Long::Configure('no_ignore_case_always');
-    GetOptions(
-        "u|url=s"    => \$opt{url},
-        "s|search=s"  => \$opt{search},
-        "p|package=s" => \$opt{package},
-        "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 $last_verbose = get_last_version( $opt{url}, $opt{search} );
-    my $current_version = get_current_version( $opt{package} );
-
-    report( $last_verbose, $current_version );
-}
-
-sub get_last_version($$) {
-    my ( $url, $search ) = @_;
-    my @webside      = ();
-    my $last_verbose = "";
-
-    my $side = get($url);
-
-    return "can't get $url" if ( !$side );
-
-    push @webside, split( "\n", $side );
-    foreach (@webside) {
-        /$search/ or next;
-        $last_verbose = $1 and last;
-    }
-    return $last_verbose if ($last_verbose);
-    return "-";
-}
-
-sub get_current_version($) {
-    my ($package) = @_;
-    my $version = undef;
-
-    my @current_version = grep { /^Version:/ } `dpkg -s $package 2> /dev/null`;
-    if ( $current_version[0] ) {
-        $current_version[0] =~ /^Version:\s+(\S+)/ and $version = $1;
-    }
-    return $version if ($version);
-    return "-";
-}
-
-sub report($$) {
-    my ( $last_verbose, $current_version ) = @_;
-
-    if ( $last_verbose eq $current_version ) {
-        say "$NAME OK: $opt{package} version $current_version";
-        exit $ERRORS{OK};
-    }
-    else {
-        say
-"$NAME WARNING: $opt{package} installed version $current_version available version $last_verbose";
-        exit $ERRORS{WARNING};
-    }
-}
-
-sub version($$) {
-    my ( $progname, $version ) = @_;
-    print <<_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_zarafa - nagios plugin to check installed zarafa version
-
-=head1 SYNOPSIS
-
-check_zarafa [B<-u>|B<--url> string] [B<-s>|B<--search> string] [B<-p>|B<--package> string]
-
-check_zarafa [B<-h>|B<--help>]
-
-check_zarafa [B<-m>|B<--man>]
-
-check_zarafa [B<-V>|B<--version>]
-
-=head1 OPTIONS
-
-=over
-
-=item B<-u>|B<--url> I<string>
-
-URL where will be look for the I<search> string ( default: http://www.zarafa.com/download-release )
-
-=item B<-s>|B<--search> I<string>
-
-Perl regular expression to search version string on the url. The content of the round brackets in the
-regular expression will be used to compare with the installed package version.
-( default: 'http://download.zarafa.com/community/final/[\d\.]+/([\d\.-]+)' )
-
-=item B<-p>|B<--package> I<string>
-
-Installed package name ( default: zarafa )
-
-=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<search> on a specified I<url> for a version string and compare the I<search> result with an installed I<package> version.
-
-=head1 VERSION
-
-This man page is current for version 0.3 of B<check_zarafa>.
-
-=head1 AUTHOR
-
-Written by Christian Arnold L<arnold@schlittermann.de>
-
-=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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/check_zarafa_version.pl	Tue Jan 20 15:32:41 2015 +0100
@@ -0,0 +1,196 @@
+#! /usr/bin/perl
+
+#   Copyright (C) 2011-2013  Christian Arnold, 2014-2015 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>
+
+use 5.010;
+use strict;
+use warnings;
+use File::Basename qw(basename);
+use Pod::Usage;
+use Getopt::Long;
+use LWP::Simple;
+
+delete @ENV{ grep /^LC_/ => keys %ENV };
+$ENV{LANG}   = "C";
+$ENV{LC_ALL} = "C";
+
+sub version($$);
+sub get_last_version($$);
+sub get_current_version($);
+sub report($$);
+
+my %ERRORS = (
+    OK        => 0,
+    WARNING   => 1,
+    CRITICAL  => 2,
+    UNKNOWN   => 3,
+    DEPENDENT => 4
+);
+
+my $ME      = basename $0;
+my $NAME    = 'ZARAFAVERSION';
+my $VERSION = '0.3';
+
+my %opt = (
+    url     => 'http://www.zarafa.com/download-release',
+    search  => 'http://download.zarafa.com/community/final/[\d\.]+/([\d\.-]+)',
+    package => 'zarafa'
+);
+
+MAIN: {
+    Getopt::Long::Configure('no_ignore_case_always');
+    GetOptions(
+        "u|url=s"    => \$opt{url},
+        "s|search=s"  => \$opt{search},
+        "p|package=s" => \$opt{package},
+        "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 $last_verbose = get_last_version( $opt{url}, $opt{search} );
+    my $current_version = get_current_version( $opt{package} );
+
+    report( $last_verbose, $current_version );
+}
+
+sub get_last_version($$) {
+    my ( $url, $search ) = @_;
+    my @webside      = ();
+    my $last_verbose = "";
+
+    my $side = get($url);
+
+    return "can't get $url" if ( !$side );
+
+    push @webside, split( "\n", $side );
+    foreach (@webside) {
+        /$search/ or next;
+        $last_verbose = $1 and last;
+    }
+    return $last_verbose if ($last_verbose);
+    return "-";
+}
+
+sub get_current_version($) {
+    my ($package) = @_;
+    my $version = undef;
+
+    my @current_version = grep { /^Version:/ } `dpkg -s $package 2> /dev/null`;
+    if ( $current_version[0] ) {
+        $current_version[0] =~ /^Version:\s+(\S+)/ and $version = $1;
+    }
+    return $version if ($version);
+    return "-";
+}
+
+sub report($$) {
+    my ( $last_verbose, $current_version ) = @_;
+
+    if ( $last_verbose eq $current_version ) {
+        say "$NAME OK: $opt{package} version $current_version";
+        exit $ERRORS{OK};
+    }
+    else {
+        say
+"$NAME WARNING: $opt{package} installed version $current_version available version $last_verbose";
+        exit $ERRORS{WARNING};
+    }
+}
+
+sub version($$) {
+    my ( $progname, $version ) = @_;
+    print <<_VERSION;
+$progname version $version
+Copyright (C) 2011-2013 by Christian Arnold, 2014-2015 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
+}
+
+__END__
+
+=head1 NAME
+
+check_zarafa_version - nagios plugin to check installed zarafa version
+
+=head1 SYNOPSIS
+
+check_zarafa_version [B<-u>|B<--url> string] [B<-s>|B<--search> string] [B<-p>|B<--package> string]
+
+check_zarafa_version [B<-h>|B<--help>]
+
+check_zarafa_version [B<-m>|B<--man>]
+
+check_zarafa_version [B<-V>|B<--version>]
+
+=head1 OPTIONS
+
+=over
+
+=item B<-u>|B<--url> I<string>
+
+URL where will be look for the I<search> string ( default: http://www.zarafa.com/download-release )
+
+=item B<-s>|B<--search> I<string>
+
+Perl regular expression to search version string on the url. The content of the round brackets in the
+regular expression will be used to compare with the installed package version.
+( default: 'http://download.zarafa.com/community/final/[\d\.]+/([\d\.-]+)' )
+
+=item B<-p>|B<--package> I<string>
+
+Installed package name ( default: zarafa )
+
+=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<search> on a specified I<url> for a version string and compare the I<search> result with an installed I<package> version.
+
+=head1 VERSION
+
+This man page is current for version 0.3 of B<check_zarafa_version>.
+
+=head1 AUTHOR
+
+Written by Christian Arnold L<arnold@schlittermann.de>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2011-2013 by Christian Arnold, 2014-2015 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 Apr 17 10:14:59 2012 +0200
+++ b/debian/changelog	Tue Jan 20 15:32:41 2015 +0100
@@ -1,3 +1,11 @@
+nagios-plugin-zarafa-version (0.6) oldstable stable; urgency=low
+
+  * renamed
+  * added missing build dep
+  * fixed some lintian warnings
+
+ -- Matthias Förste <foerste@schlittermann.de>  Tue, 20 Jan 2015 14:34:00 +0100
+
 nagios-plugin-zarafa (0.5) lenny squeeze; urgency=low
 
   * remove perl-base from depends in debian control file
--- a/debian/control	Tue Apr 17 10:14:59 2012 +0200
+++ b/debian/control	Tue Jan 20 15:32:41 2015 +0100
@@ -1,12 +1,12 @@
-Source: nagios-plugin-zarafa
+Source: nagios-plugin-zarafa-version
 Section: net
 Priority: extra
-Maintainer: Christian Arnold <arnold@schlittermann.de>
-Build-Depends: debhelper (>= 7.0.50~)
-Standards-Version: 3.9.1
-Homepage: https://keller.schlittermann.de/hg/ius/nagios/nagios-plugin-zarafa/
+Maintainer: Matthias Förste <foerste@schlittermann.de>
+Build-Depends: debhelper (>= 7.0.50~), libwww-perl
+Standards-Version: 3.9.4
+Homepage: https://ssl.schlittermann.de/hg/ius/nagios/nagios-plugin-zarafa-version/
 
-Package: nagios-plugin-zarafa
+Package: nagios-plugin-zarafa-version
 Architecture: all
 Depends: perl-doc, libwww-perl, ${misc:Depends}
 Description: nagios plugin to check installed zarafa version
--- a/debian/copyright	Tue Apr 17 10:14:59 2012 +0200
+++ b/debian/copyright	Tue Jan 20 15:32:41 2015 +0100
@@ -4,15 +4,15 @@
 
 It was downloaded from:
 
-    https://keller.schlittermann.de/hg/ius/nagios/nagios-plugin-zarafa/
+    https://ssl.schlittermann.de/hg/ius/nagios/nagios-plugin-zarafa-version/
 
-Upstream Author(s):
+Upstream Author:
 
     Christian Arnold <arnold@schlittermann.de>
 
 Copyright:
 
-    Copyright (C) 2011 Schlittermann internet & unix support
+    Copyright (C) 2011-2015 Schlittermann internet & unix support
 
 License:
 
@@ -34,6 +34,7 @@
 
 The Debian packaging is:
 
-    Copyright (C) 2011 Christian Arnold <arnold@schlittermann.de>
+    Copyright (C) 2011-2013 Christian Arnold <arnold@schlittermann.de>,
+    2014-2015 Matthias Förste <foerste@schlittermann.de>
 
 and is licensed under the GPL version 3, see above.