From 5b545ac648db171035f2f4ef72e71dc79009caf0 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 9 Jul 2017 17:29:17 +0200 Subject: [PATCH] check_sieve: Add support to detect perl monitoring and nagios plugins --- check_sieve/control | 2 +- debian/patches/check_sieve/MonitoringPlugin | 42 +++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 debian/patches/check_sieve/MonitoringPlugin diff --git a/check_sieve/control b/check_sieve/control index b93b96c..f79eb40 100644 --- a/check_sieve/control +++ b/check_sieve/control @@ -1,6 +1,6 @@ Homepage: https://raw.githubusercontent.com/alan-hicks/check_sieve/master/check_sieve.pl Watch: https://raw.githubusercontent.com/alan-hicks/check_sieve/master/check_sieve.pl \$VERSION\ =\ '([0-9.]+)' -Recommends: libio-socket-inet6-perl, monitoring-plugins-common | nagios-plugins-common +Recommends: libio-socket-inet6-perl, libmonitoring-plugin-perl | libmonitoring-plugin-perl Version: 1.02 Uploaders: Jan Wagner Description: plugin checking for a running Sieve daemon diff --git a/debian/patches/check_sieve/MonitoringPlugin b/debian/patches/check_sieve/MonitoringPlugin new file mode 100644 index 0000000..2e0f218 --- /dev/null +++ b/debian/patches/check_sieve/MonitoringPlugin @@ -0,0 +1,42 @@ +--- a/check_sieve/check_sieve ++++ b/check_sieve/check_sieve +@@ -36,7 +36,6 @@ + use warnings; + use IO::Socket::INET6; + use Time::HiRes; +-use Nagios::Plugin; + + use vars qw($VERSION $PROGNAME); + use vars qw($start $duration $sock $family $code $line $implementation); +@@ -48,8 +47,30 @@ + $PROGNAME = basename($0); + + ++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; ++ ++$plugin_module = load_module( 'Monitoring::Plugin', 'Nagios::Plugin' ); #libmonitoring-plugin-perl or libnagios-plugin-perl ++ + # Instantiate Nagios::Plugin object (the 'usage' parameter is mandatory) +-my $p = Nagios::Plugin->new( ++my $p = $plugin_module->new( + usage => "Usage: %s + [ -v|--verbose ] + [ -H|--host ] diff --git a/debian/patches/series b/debian/patches/series index 6501d9f..13227ad 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -6,5 +6,6 @@ check_ipsec/20_remove_gateway check_mysql_slave//epn check_sieve/epn check_sieve/10_pathes +check_sieve/MonitoringPlugin check_tftp/epn check_tomcat/epn