git.lirion.de

Of git, get, and gud

summaryrefslogtreecommitdiffstats
path: root/nagios-plugins-contrib-24.20190301~bpo9+1/debian/patches/check_httpd_status/monitoring-plugin
blob: dd8451af40974b3952158b33aa74c5ba3d548859 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
--- a/check_httpd_status/check_httpd_status
+++ b/check_httpd_status/check_httpd_status
 _æ_  _æ_  -34,8 +34,28  _æ_  _æ_ 
 use POSIX qw(setlocale);
 use Locale::gettext;
 
-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;
 use HTTP::Status; # get status_message()
 use Time::HiRes qw(gettimeofday tv_interval);
 _æ_  _æ_  -92,7 +112,7  _æ_  _æ_ 
 );
 
 
-my $np = Nagios::Plugin->new(
+my $np = $plugin_module->new(
 	version => $VERSION,
 	blurb => _gt('Apache / Lighthttpd server status monitor for Nagios'),
 	usage => "Usage: %s [ -H  [-p ] [-t ] [-w  -c ] [-V] [-u ] [-U user -P pass -r realm]",
 _æ_  _æ_  -438,4 +458,4  _æ_  _æ_ 
         Warn if less than 100 workers are available
         Crit if less than 10 workers are available
 EOT
-}
\ No newline at end of file
+}