diff options
author | Subhendu Ghosh <sghosh@users.sourceforge.net> | 2002-05-02 16:43:29 (GMT) |
---|---|---|
committer | Subhendu Ghosh <sghosh@users.sourceforge.net> | 2002-05-02 16:43:29 (GMT) |
commit | becc0f34e60500798bd15bf5af6e4b8c52707d0a (patch) | |
tree | c117e73085955568f57d4eb89f41640297796977 | |
parent | bbcaeb1db1666c606a3578d3d24f1618f8c9947c (diff) | |
download | monitoring-plugins-becc0f34e60500798bd15bf5af6e4b8c52707d0a.tar.gz |
fix for embedded perl
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@21 f882894a-f735-0410-b71e-b25c423dba1c
-rwxr-xr-x | plugins-scripts/check_breeze.pl | 26 | ||||
-rwxr-xr-x | plugins-scripts/check_disk_smb.pl | 14 | ||||
-rwxr-xr-x | plugins-scripts/check_flexlm.pl | 10 | ||||
-rwxr-xr-x | plugins-scripts/check_ircd.pl | 12 | ||||
-rwxr-xr-x | plugins-scripts/check_netdns.pl | 13 | ||||
-rwxr-xr-x | plugins-scripts/check_ntp.pl | 14 | ||||
-rwxr-xr-x | plugins-scripts/check_rpc.pl | 10 | ||||
-rwxr-xr-x | plugins-scripts/check_wave.pl | 10 |
8 files changed, 47 insertions, 62 deletions
diff --git a/plugins-scripts/check_breeze.pl b/plugins-scripts/check_breeze.pl index 79e36be..bd73f42 100755 --- a/plugins-scripts/check_breeze.pl +++ b/plugins-scripts/check_breeze.pl | |||
@@ -1,16 +1,11 @@ | |||
1 | #! /usr/bin/perl -wT | 1 | #! /usr/bin/perl -wT |
2 | 2 | ||
3 | BEGIN { | ||
4 | if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) { | ||
5 | $runtimedir = $1; | ||
6 | $PROGNAME = $2; | ||
7 | } | ||
8 | } | ||
9 | 3 | ||
10 | use strict; | 4 | use strict; |
11 | use Getopt::Long; | 5 | use Getopt::Long; |
12 | use vars qw($opt_V $opt_h $opt_H $opt_w $opt_c $PROGNAME); | 6 | use vars qw($opt_V $opt_h $opt_H $opt_w $opt_c $PROGNAME); |
13 | use lib $main::runtimedir; | 7 | use FindBin; |
8 | use lib "$FindBin::Bin" ; | ||
14 | use utils qw(%ERRORS &print_revision &support &usage); | 9 | use utils qw(%ERRORS &print_revision &support &usage); |
15 | 10 | ||
16 | sub print_help (); | 11 | sub print_help (); |
@@ -26,7 +21,8 @@ GetOptions | |||
26 | "h" => \$opt_h, "help" => \$opt_h, | 21 | "h" => \$opt_h, "help" => \$opt_h, |
27 | "w=s" => \$opt_w, "warning=s" => \$opt_w, | 22 | "w=s" => \$opt_w, "warning=s" => \$opt_w, |
28 | "c=s" => \$opt_c, "critical=s" => \$opt_c, | 23 | "c=s" => \$opt_c, "critical=s" => \$opt_c, |
29 | "H=s" => \$opt_H, "hostname=s" => \$opt_H); | 24 | "H=s" => \$opt_H, "hostname=s" => \$opt_H, |
25 | "C=s" => \$opt_C, "community=s" => \$opt_C); | ||
30 | 26 | ||
31 | if ($opt_V) { | 27 | if ($opt_V) { |
32 | print_revision($PROGNAME,'$Revision$'); | 28 | print_revision($PROGNAME,'$Revision$'); |
@@ -35,20 +31,22 @@ if ($opt_V) { | |||
35 | 31 | ||
36 | if ($opt_h) {print_help(); exit $ERRORS{'OK'};} | 32 | if ($opt_h) {print_help(); exit $ERRORS{'OK'};} |
37 | 33 | ||
38 | ($opt_H) || ($opt_H = shift) || usage("Host name/address not specified\n"); | 34 | ($opt_H) || usage("Host name/address not specified\n"); |
39 | my $host = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/); | 35 | my $host = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/); |
40 | ($host) || usage("Invalid host: $opt_H\n"); | 36 | ($host) || usage("Invalid host: $opt_H\n"); |
41 | 37 | ||
42 | ($opt_w) || ($opt_w = shift) || usage("Warning threshold not specified\n"); | 38 | ($opt_w) || usage("Warning threshold not specified\n"); |
43 | my $warning = $1 if ($opt_w =~ /([0-9]{1,2}|100)+/); | 39 | my $warning = $1 if ($opt_w =~ /([0-9]{1,2}|100)+/); |
44 | ($warning) || usage("Invalid warning threshold: $opt_w\n"); | 40 | ($warning) || usage("Invalid warning threshold: $opt_w\n"); |
45 | 41 | ||
46 | ($opt_c) || ($opt_c = shift) || usage("Critical threshold not specified\n"); | 42 | ($opt_c) || usage("Critical threshold not specified\n"); |
47 | my $critical = $1 if ($opt_c =~ /([0-9]{1,2}|100)/); | 43 | my $critical = $1 if ($opt_c =~ /([0-9]{1,2}|100)/); |
48 | ($critical) || usage("Invalid critical threshold: $opt_c\n"); | 44 | ($critical) || usage("Invalid critical threshold: $opt_c\n"); |
49 | 45 | ||
46 | ($opt_C) || ($opt_C = "public") ; | ||
47 | |||
50 | my $sig=0; | 48 | my $sig=0; |
51 | $sig = `/usr/bin/snmpget $host public .1.3.6.1.4.1.710.3.2.3.1.3.0`; | 49 | $sig = `/usr/bin/snmpget $host $opt_C .1.3.6.1.4.1.710.3.2.3.1.3.0`; |
52 | my @test=split(/ /,$sig); | 50 | my @test=split(/ /,$sig); |
53 | $sig=$test[2]; | 51 | $sig=$test[2]; |
54 | $sig=int($sig); | 52 | $sig=int($sig); |
@@ -62,7 +60,7 @@ exit $ERRORS{'OK'}; | |||
62 | 60 | ||
63 | 61 | ||
64 | sub print_usage () { | 62 | sub print_usage () { |
65 | print "Usage: $PROGNAME -H <host> -w <warn> -c <crit>\n"; | 63 | print "Usage: $PROGNAME -H <host> [-C community] -w <warn> -c <crit>\n"; |
66 | } | 64 | } |
67 | 65 | ||
68 | sub print_help () { | 66 | sub print_help () { |
@@ -76,6 +74,8 @@ This plugin reports the signal strength of a Breezecom wireless equipment | |||
76 | print " | 74 | print " |
77 | -H, --hostname=HOST | 75 | -H, --hostname=HOST |
78 | Name or IP address of host to check | 76 | Name or IP address of host to check |
77 | -C, --community=community | ||
78 | SNMPv1 community (default public) | ||
79 | -w, --warning=INTEGER | 79 | -w, --warning=INTEGER |
80 | Percentage strength below which a WARNING status will result | 80 | Percentage strength below which a WARNING status will result |
81 | -c, --critical=INTEGER | 81 | -c, --critical=INTEGER |
diff --git a/plugins-scripts/check_disk_smb.pl b/plugins-scripts/check_disk_smb.pl index d1b0b3d..9a66ed5 100755 --- a/plugins-scripts/check_disk_smb.pl +++ b/plugins-scripts/check_disk_smb.pl | |||
@@ -14,13 +14,10 @@ | |||
14 | # Modified [warn] and [critical] parameters to accept format of nnn[M|G] to | 14 | # Modified [warn] and [critical] parameters to accept format of nnn[M|G] to |
15 | # allow setting of limits in MBytes or GBytes. Percentage settings for large | 15 | # allow setting of limits in MBytes or GBytes. Percentage settings for large |
16 | # drives is a pain in the butt | 16 | # drives is a pain in the butt |
17 | 17 | # 2-May-2002 - SGhosh fix for embedded perl | |
18 | BEGIN { | 18 | # |
19 | if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) { | 19 | # $Id$ |
20 | $runtimedir = $1; | 20 | # |
21 | $PROGNAME = $2; | ||
22 | } | ||
23 | } | ||
24 | 21 | ||
25 | require 5.004; | 22 | require 5.004; |
26 | use POSIX; | 23 | use POSIX; |
@@ -28,7 +25,8 @@ use strict; | |||
28 | use Getopt::Long; | 25 | use Getopt::Long; |
29 | use vars qw($opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $verbose); | 26 | use vars qw($opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $verbose); |
30 | use vars qw($PROGNAME); | 27 | use vars qw($PROGNAME); |
31 | use lib $main::runtimedir; | 28 | use FindBin; |
29 | use lib "$FindBin::Bin"; | ||
32 | use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); | 30 | use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); |
33 | 31 | ||
34 | sub print_help (); | 32 | sub print_help (); |
diff --git a/plugins-scripts/check_flexlm.pl b/plugins-scripts/check_flexlm.pl index 1d26b7c..595a0b3 100755 --- a/plugins-scripts/check_flexlm.pl +++ b/plugins-scripts/check_flexlm.pl | |||
@@ -26,19 +26,15 @@ | |||
26 | # initial version: 9-10-99 Ernst-Dieter Martin edmt@infineon.com | 26 | # initial version: 9-10-99 Ernst-Dieter Martin edmt@infineon.com |
27 | # | 27 | # |
28 | # License: GPL | 28 | # License: GPL |
29 | # $Id$ | ||
29 | # | 30 | # |
30 | 31 | ||
31 | BEGIN { | ||
32 | if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) { | ||
33 | $runtimedir = $1; | ||
34 | $PROGNAME = $2; | ||
35 | } | ||
36 | } | ||
37 | 32 | ||
38 | use strict; | 33 | use strict; |
39 | use Getopt::Long; | 34 | use Getopt::Long; |
40 | use vars qw($opt_V $opt_h $opt_F $verbose $PROGNAME); | 35 | use vars qw($opt_V $opt_h $opt_F $verbose $PROGNAME); |
41 | use lib $main::runtimedir; | 36 | use FindBin ; |
37 | use lib "$FindBin::Bin"; | ||
42 | use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); | 38 | use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); |
43 | 39 | ||
44 | sub print_help (); | 40 | sub print_help (); |
diff --git a/plugins-scripts/check_ircd.pl b/plugins-scripts/check_ircd.pl index e4c4bd0..098a8e7 100755 --- a/plugins-scripts/check_ircd.pl +++ b/plugins-scripts/check_ircd.pl | |||
@@ -38,15 +38,8 @@ | |||
38 | # with perl -wT and 'use strict' | 38 | # with perl -wT and 'use strict' |
39 | # | 39 | # |
40 | # test using check_ircd.pl (irc-2.mit.edu|irc.erols.com|irc.core.com) | 40 | # test using check_ircd.pl (irc-2.mit.edu|irc.erols.com|irc.core.com) |
41 | # 2002/05/02 SG Fixed for Embedded Perl | ||
41 | # | 42 | # |
42 | # ------------------------------------------------------------------[ Begin ]-- | ||
43 | |||
44 | BEGIN { | ||
45 | if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) { | ||
46 | $runtimedir = $1; | ||
47 | $PROGNAME = $2; | ||
48 | } | ||
49 | } | ||
50 | 43 | ||
51 | # ----------------------------------------------------------------[ Require ]-- | 44 | # ----------------------------------------------------------------[ Require ]-- |
52 | 45 | ||
@@ -59,7 +52,8 @@ use strict; | |||
59 | use Getopt::Long; | 52 | use Getopt::Long; |
60 | use vars qw($opt_V $opt_h $opt_t $opt_p $opt_H $opt_w $opt_c $verbose); | 53 | use vars qw($opt_V $opt_h $opt_t $opt_p $opt_H $opt_w $opt_c $verbose); |
61 | use vars qw($PROGNAME); | 54 | use vars qw($PROGNAME); |
62 | use lib $main::runtimedir; | 55 | use FindBin; |
56 | use lib "$FindBin::Bin"; | ||
63 | use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); | 57 | use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); |
64 | 58 | ||
65 | # ----------------------------------------------------[ Function Prototypes ]-- | 59 | # ----------------------------------------------------[ Function Prototypes ]-- |
diff --git a/plugins-scripts/check_netdns.pl b/plugins-scripts/check_netdns.pl index 4bf7bd7..65ad7be 100755 --- a/plugins-scripts/check_netdns.pl +++ b/plugins-scripts/check_netdns.pl | |||
@@ -6,8 +6,11 @@ | |||
6 | # Copyright 2000, virCIO, LLP | 6 | # Copyright 2000, virCIO, LLP |
7 | # | 7 | # |
8 | # $Log$ | 8 | # $Log$ |
9 | # Revision 1.1 2002/02/28 06:43:00 egalstad | 9 | # Revision 1.2 2002/05/02 16:43:29 sghosh |
10 | # Initial revision | 10 | # fix for embedded perl |
11 | # | ||
12 | # Revision 1.1.1.1 2002/02/28 06:43:00 egalstad | ||
13 | # Initial import of existing plugin code | ||
11 | # | 14 | # |
12 | # Revision 1.1 2000/08/03 20:41:12 karldebisschop | 15 | # Revision 1.1 2000/08/03 20:41:12 karldebisschop |
13 | # rename to avoid conflict when installing | 16 | # rename to avoid conflict when installing |
@@ -18,11 +21,15 @@ | |||
18 | # Revision 1.1 2000/07/20 19:09:13 cwg | 21 | # Revision 1.1 2000/07/20 19:09:13 cwg |
19 | # All the pieces needed to use my version of check_dns. | 22 | # All the pieces needed to use my version of check_dns. |
20 | # | 23 | # |
24 | # | ||
21 | 25 | ||
22 | use Getopt::Long; | 26 | use Getopt::Long; |
23 | use Net::DNS; | 27 | use Net::DNS; |
28 | use Findbin; | ||
29 | use lib "$FindBin::Bin"; | ||
30 | use utils ; | ||
24 | 31 | ||
25 | Getopt::Long::Configure(`bundling`); | 32 | Getopt::Long::Configure(`bundling`); |
26 | GetOptions("V" => $opt_V, "version" => $opt_V, | 33 | GetOptions("V" => $opt_V, "version" => $opt_V, |
27 | "h" => $opt_h, "help" => $opt_h, | 34 | "h" => $opt_h, "help" => $opt_h, |
28 | "t=i" => $opt_t, "timeout=i" => $opt_t, | 35 | "t=i" => $opt_t, "timeout=i" => $opt_t, |
diff --git a/plugins-scripts/check_ntp.pl b/plugins-scripts/check_ntp.pl index f3f6f78..918ad50 100755 --- a/plugins-scripts/check_ntp.pl +++ b/plugins-scripts/check_ntp.pl | |||
@@ -7,6 +7,8 @@ | |||
7 | # be installed on the system, however since it's part of the ntp suite, you | 7 | # be installed on the system, however since it's part of the ntp suite, you |
8 | # should already have it installed. | 8 | # should already have it installed. |
9 | # | 9 | # |
10 | # $Id$ | ||
11 | # | ||
10 | # Nothing clever done in this program - its a very simple bare basics hack to | 12 | # Nothing clever done in this program - its a very simple bare basics hack to |
11 | # get the job done. | 13 | # get the job done. |
12 | # | 14 | # |
@@ -45,19 +47,17 @@ | |||
45 | # source. This happens while starting up and if contact | 47 | # source. This happens while starting up and if contact |
46 | # with master has been lost. | 48 | # with master has been lost. |
47 | # | 49 | # |
48 | BEGIN { | 50 | # Modifed to run under Embedded Perl - patch from Douglas Warner |
49 | if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) { | 51 | # |
50 | $runtimedir = $1; | 52 | |
51 | $PROGNAME = $2; | ||
52 | } | ||
53 | } | ||
54 | 53 | ||
55 | require 5.004; | 54 | require 5.004; |
56 | use POSIX; | 55 | use POSIX; |
57 | use strict; | 56 | use strict; |
58 | use Getopt::Long; | 57 | use Getopt::Long; |
59 | use vars qw($opt_V $opt_h $opt_H $opt_w $opt_c $verbose $PROGNAME); | 58 | use vars qw($opt_V $opt_h $opt_H $opt_w $opt_c $verbose $PROGNAME); |
60 | use lib $main::runtimedir; | 59 | use FindBin; |
60 | use lib "$FindBin::Bin"; | ||
61 | use utils qw($TIMEOUT %ERRORS &print_revision &support); | 61 | use utils qw($TIMEOUT %ERRORS &print_revision &support); |
62 | 62 | ||
63 | sub print_help (); | 63 | sub print_help (); |
diff --git a/plugins-scripts/check_rpc.pl b/plugins-scripts/check_rpc.pl index 51901ac..2e25f41 100755 --- a/plugins-scripts/check_rpc.pl +++ b/plugins-scripts/check_rpc.pl | |||
@@ -18,15 +18,11 @@ | |||
18 | # | 18 | # |
19 | # Copyright Notice: GPL | 19 | # Copyright Notice: GPL |
20 | # | 20 | # |
21 | BEGIN { | 21 | |
22 | if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) { | ||
23 | $runtimedir = $1; | ||
24 | $PROGNAME = $2; | ||
25 | } | ||
26 | } | ||
27 | 22 | ||
28 | use strict; | 23 | use strict; |
29 | use lib $main::runtimedir; | 24 | use FindBin; |
25 | use lib "$FindBin::Bin"; | ||
30 | use utils qw($TIMEOUT %ERRORS &print_revision &support); | 26 | use utils qw($TIMEOUT %ERRORS &print_revision &support); |
31 | use vars qw($PROGNAME); | 27 | use vars qw($PROGNAME); |
32 | my ($verbose,@proto,%prognum,$host,$response,$prognum,$port,$cmd); | 28 | my ($verbose,@proto,%prognum,$host,$response,$prognum,$port,$cmd); |
diff --git a/plugins-scripts/check_wave.pl b/plugins-scripts/check_wave.pl index c6e6c66..6d58e4f 100755 --- a/plugins-scripts/check_wave.pl +++ b/plugins-scripts/check_wave.pl | |||
@@ -3,15 +3,9 @@ | |||
3 | # $Id$ | 3 | # $Id$ |
4 | 4 | ||
5 | 5 | ||
6 | BEGIN { | ||
7 | if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) { | ||
8 | $runtimedir = $1; | ||
9 | $PROGNAME = $2; | ||
10 | } | ||
11 | } | ||
12 | |||
13 | use strict; | 6 | use strict; |
14 | use lib $main::runtimedir; | 7 | use FindBin; |
8 | use lib "$Findbin::Bin"; | ||
15 | use utils qw($TIMEOUT %ERRORS &print_revision &support); | 9 | use utils qw($TIMEOUT %ERRORS &print_revision &support); |
16 | use vars qw($PROGNAME); | 10 | use vars qw($PROGNAME); |
17 | use Getopt::Long; | 11 | use Getopt::Long; |