diff options
author | Subhendu Ghosh <sghosh@users.sourceforge.net> | 2002-05-02 16:43:29 +0000 |
---|---|---|
committer | Subhendu Ghosh <sghosh@users.sourceforge.net> | 2002-05-02 16:43:29 +0000 |
commit | becc0f34e60500798bd15bf5af6e4b8c52707d0a (patch) | |
tree | c117e73085955568f57d4eb89f41640297796977 /plugins-scripts/check_breeze.pl | |
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
Diffstat (limited to 'plugins-scripts/check_breeze.pl')
-rwxr-xr-x | plugins-scripts/check_breeze.pl | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/plugins-scripts/check_breeze.pl b/plugins-scripts/check_breeze.pl index 79e36be7..bd73f42a 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 |