[Pkg-nagios-changes] [pkg-nagios-plugins-contrib] 25/32: port check_cups and check_haproxy to Monitoring::Plugin

Jan Wagner waja at moszumanska.debian.org
Fri Nov 18 17:23:04 UTC 2016


This is an automated email from the git hooks/post-receive script.

waja pushed a commit to branch master
in repository pkg-nagios-plugins-contrib.

commit 3537b847d8ee4bea86c053cf8806c56eac4e865a
Author: Evgeni Golov <evgeni at golov.de>
Date:   Sat Sep 24 17:30:13 2016 +0200

    port check_cups and check_haproxy to Monitoring::Plugin
---
 check_cups/control                             |  2 +-
 check_haproxy/control                          |  2 +-
 debian/patches/check_cups/monitoring-plugin    | 48 +++++++++++++++++++++++++
 debian/patches/check_haproxy/monitoring-plugin | 50 ++++++++++++++++++++++++++
 debian/patches/series                          |  2 ++
 5 files changed, 102 insertions(+), 2 deletions(-)

diff --git a/check_cups/control b/check_cups/control
index 855026d..0dfbf33 100644
--- a/check_cups/control
+++ b/check_cups/control
@@ -4,5 +4,5 @@ Description: plugin to check queues on a remote CUPS server
  This plugin is monitoring of queues on a remote CUPS server,
  which means that it doesn't need to be installed on the print
  server and run via NRPE.
-Recommends: libdate-manip-perl, libnagios-plugin-perl (>= 0.31), libnet-cups-perl
+Recommends: libdate-manip-perl, libmonitoring-plugin-perl | libnagios-plugin-perl (>= 0.31), libnet-cups-perl
 Version: 0.2
diff --git a/check_haproxy/control b/check_haproxy/control
index 56c3a90..85fbbc5 100644
--- a/check_haproxy/control
+++ b/check_haproxy/control
@@ -1,6 +1,6 @@
 Homepage: http://cvs.orion.education.fr/viewvc/viewvc.cgi/nagios-plugins-perl/trunk/plugins/check_haproxy.pl?view=log
 Watch: http://cvs.orion.education.fr/viewvc/viewvc.cgi/nagios-plugins-perl/trunk/plugins/check_haproxy.pl?view=log <a name="(rev[^"]+)"></a>
-Recommends: liblocale-gettext-perl, liblwp-useragent-determined-perl
+Recommends: liblocale-gettext-perl, liblwp-useragent-determined-perl, libmonitoring-plugin-perl | libnagios-plugin-perl
 Version: rev135
 Uploaders: Jan Wagner <waja at cyconet.org>
 Description: plugin to check the HAProxy statistics url
diff --git a/debian/patches/check_cups/monitoring-plugin b/debian/patches/check_cups/monitoring-plugin
new file mode 100644
index 0000000..a55baee
--- /dev/null
+++ b/debian/patches/check_cups/monitoring-plugin
@@ -0,0 +1,48 @@
+diff --git a/check_cups/check_cups b/check_cups/check_cups
+index b202fbc..c376b1d 100644
+--- a/check_cups/check_cups
++++ b/check_cups/check_cups
+@@ -38,13 +38,33 @@ use warnings;
+ # http://search.cpan.org/~rgarcia/perl-5.6.2/pod/perllexwarn.pod
+ no warnings qw( redefine prototype );
+ 
++sub load_module {
++    my @names = @_;
++    my $module;
++    for my $name (@names) {
++        my $file = $name;
++        # requires need either a bare word or a file name
++        $file =~ s{::}{/}gsxm;
++        $file .= '.pm';
++        eval {
++            require $file;
++            $name->import();
++            $module = $name;
++		};
++		last if $module;
++    }
++    return $module;
++}
++
++my $plugin_module;
++
+ BEGIN {
+ 
+     # use Opsview libs
+     use lib '/usr/local/nagios/perl/lib';
+     use lib '/usr/local/nagios/lib';
+ 
+-    use Nagios::Plugin;
++    $plugin_module = load_module( 'Monitoring::Plugin', 'Nagios::Plugin' );
+ 
+     use Data::Dumper;
+ 
+@@ -94,7 +114,7 @@ General Public Licence (see http://www.fsf.org/licensing/licenses/gpl.txt).
+ This plugin was written at The Harvard-MIT Data Center
+ (http://www.hmdc.harvard.edu) by Steve Huff (<shuff\@hmdc.harvard.edu>).
+ LICENSE
+-my( $plugin ) = Nagios::Plugin->new( 
++my( $plugin ) = $plugin_module->new(
+                                     shortname   => 'check_cups',
+                                     usage       => $usagemsg,
+                                     version     => '0.2',
diff --git a/debian/patches/check_haproxy/monitoring-plugin b/debian/patches/check_haproxy/monitoring-plugin
new file mode 100644
index 0000000..79ab552
--- /dev/null
+++ b/debian/patches/check_haproxy/monitoring-plugin
@@ -0,0 +1,50 @@
+diff --git a/check_haproxy/check_haproxy b/check_haproxy/check_haproxy
+index 1da4240..875ab1f 100644
+--- a/check_haproxy/check_haproxy
++++ b/check_haproxy/check_haproxy
+@@ -30,7 +30,28 @@ use POSIX qw(setlocale);
+ use Time::HiRes qw(time);			# get microtime
+ use POSIX qw(mktime);
+ 
+-use Nagios::Plugin ;
++sub load_module {
++    my @names = @_;
++    my $module;
++    for my $name (@names) {
++        my $file = $name;
++        # requires need either a bare word or a file name
++        $file =~ s{::}{/}gsxm;
++        $file .= '.pm';
++        eval {
++            require $file;
++            $name->import();
++            $module = $name;
++		};
++		last if $module;
++    }
++    return $module;
++}
++
++my $plugin_module;
++BEGIN {
++	$plugin_module = load_module( 'Monitoring::Plugin', 'Nagios::Plugin' );
++}
+ 
+ use LWP::UserAgent;			# http client
+ use HTTP::Request;			# used by LWP::UserAgent
+@@ -52,7 +73,7 @@ setlocale(LC_MESSAGES, '');
+ textdomain('nagios-plugins-perl');
+ 
+ 
+-my $np = Nagios::Plugin->new(
++my $np = $plugin_module->new(
+ 	version => $VERSION,
+ 	blurb => _gt('Plugin to check HAProxy stats url'),
+ 	usage => "Usage: %s [ -v|--verbose ]  -u <url> [-t <timeout>] [-U <username>] [-P <password>] [ -c|--critical=<threshold> ] [ -w|--warning=<threshold> ]",
+@@ -318,4 +339,4 @@ In F<services.cfg> you just have to add something like :
+ 
+ Stéphane Urbanovski <stephane.urbanovski at ac-nancy-metz.fr>
+ 
+-=cut
+\ No newline at end of file
++=cut
diff --git a/debian/patches/series b/debian/patches/series
index 7d97df0..f777317 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,10 +3,12 @@ check_backuppc/use_nagios_plugins
 check_bgpstate/epn
 check_clamav/clamav_locations
 check_cups/epn
+check_cups/monitoring-plugin
 check_drbd/fix_for_oos_and_cosmetic
 check_email_delivery/epn
 check_email_delivery/paths
 check_haproxy/epn
+check_haproxy/monitoring-plugin
 check_httpd_status/epn
 check_imap_quota/syntax_error_fix
 check_libs/lsof-speedup

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-nagios-plugins-contrib.git



More information about the Pkg-nagios-changes mailing list