check_sieve: Add support to detect perl monitoring and nagios plugins
This commit is contained in:
parent
ba39a8dcef
commit
5b545ac648
|
@ -1,6 +1,6 @@
|
||||||
Homepage: https://raw.githubusercontent.com/alan-hicks/check_sieve/master/check_sieve.pl
|
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.]+)'
|
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
|
Version: 1.02
|
||||||
Uploaders: Jan Wagner <waja@cyconet.org>
|
Uploaders: Jan Wagner <waja@cyconet.org>
|
||||||
Description: plugin checking for a running Sieve daemon
|
Description: plugin checking for a running Sieve daemon
|
||||||
|
|
42
debian/patches/check_sieve/MonitoringPlugin
vendored
Normal file
42
debian/patches/check_sieve/MonitoringPlugin
vendored
Normal file
|
@ -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 <host>]
|
1
debian/patches/series
vendored
1
debian/patches/series
vendored
|
@ -6,5 +6,6 @@ check_ipsec/20_remove_gateway
|
||||||
check_mysql_slave//epn
|
check_mysql_slave//epn
|
||||||
check_sieve/epn
|
check_sieve/epn
|
||||||
check_sieve/10_pathes
|
check_sieve/10_pathes
|
||||||
|
check_sieve/MonitoringPlugin
|
||||||
check_tftp/epn
|
check_tftp/epn
|
||||||
check_tomcat/epn
|
check_tomcat/epn
|
||||||
|
|
Loading…
Reference in a new issue