Debian Codegraph @

debian/patches/check_smstools/monitoring-plugin

raw
1 Index: pkg-nagios-plugins-contrib/check_smstools/bin/check_smstools
2 ===================================================================
3 --- pkg-nagios-plugins-contrib.orig/check_smstools/bin/check_smstools
4 +++ pkg-nagios-plugins-contrib/check_smstools/bin/check_smstools
5 @@ -13,9 +13,31 @@
6
7 use strict;
8 use warnings;
9 -use Nagios::Plugin;
10 use POSIX;
11
12 +sub load_module {
13 + my @names = @_;
14 + my $module;
15 + for my $name (@names) {
16 + my $file = $name;
17 + # requires need either a bare word or a file name
18 + $file =~ s{::}{/}gsxm;
19 + $file .= '.pm';
20 + eval {
21 + require $file;
22 + $name->import();
23 + $module = $name;
24 + };
25 + last if $module;
26 + }
27 + return $module;
28 +}
29 +
30 +my $plugin_module;
31 +BEGIN {
32 + $plugin_module = load_module( 'Monitoring::Plugin', 'Nagios::Plugin' );
33 +}
34 +
35 # Define regular expressions used to find the correct lines from
36 # the status file
37 my $signal_command = 'AT\+CSQ';
38 @@ -45,7 +67,7 @@ my $timestamp;
39 my $np;
40
41 sub init_plugin {
42 - $np = Nagios::Plugin->new(usage => "usage: %s");
43 + $np = $plugin_module->new(usage => "usage: %s");
44
45 $np->add_arg(
46 spec => 'warning|w=f',