summaryrefslogtreecommitdiffstats
path: root/plugins-scripts/check_breeze.pl
diff options
context:
space:
mode:
authorSubhendu Ghosh <sghosh@users.sourceforge.net>2002-05-02 16:43:29 (GMT)
committerSubhendu Ghosh <sghosh@users.sourceforge.net>2002-05-02 16:43:29 (GMT)
commitbecc0f34e60500798bd15bf5af6e4b8c52707d0a (patch)
treec117e73085955568f57d4eb89f41640297796977 /plugins-scripts/check_breeze.pl
parentbbcaeb1db1666c606a3578d3d24f1618f8c9947c (diff)
downloadmonitoring-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-xplugins-scripts/check_breeze.pl26
1 files changed, 13 insertions, 13 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
3BEGIN {
4 if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) {
5 $runtimedir = $1;
6 $PROGNAME = $2;
7 }
8}
9 3
10use strict; 4use strict;
11use Getopt::Long; 5use Getopt::Long;
12use vars qw($opt_V $opt_h $opt_H $opt_w $opt_c $PROGNAME); 6use vars qw($opt_V $opt_h $opt_H $opt_w $opt_c $PROGNAME);
13use lib $main::runtimedir; 7use FindBin;
8use lib "$FindBin::Bin" ;
14use utils qw(%ERRORS &print_revision &support &usage); 9use utils qw(%ERRORS &print_revision &support &usage);
15 10
16sub print_help (); 11sub 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
31if ($opt_V) { 27if ($opt_V) {
32 print_revision($PROGNAME,'$Revision$'); 28 print_revision($PROGNAME,'$Revision$');
@@ -35,20 +31,22 @@ if ($opt_V) {
35 31
36if ($opt_h) {print_help(); exit $ERRORS{'OK'};} 32if ($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");
39my $host = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/); 35my $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");
43my $warning = $1 if ($opt_w =~ /([0-9]{1,2}|100)+/); 39my $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");
47my $critical = $1 if ($opt_c =~ /([0-9]{1,2}|100)/); 43my $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
50my $sig=0; 48my $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`;
52my @test=split(/ /,$sig); 50my @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
64sub print_usage () { 62sub 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
68sub print_help () { 66sub 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