summaryrefslogtreecommitdiffstats
path: root/plugins-scripts/check_breeze.pl
diff options
context:
space:
mode:
Diffstat (limited to 'plugins-scripts/check_breeze.pl')
-rwxr-xr-xplugins-scripts/check_breeze.pl86
1 files changed, 86 insertions, 0 deletions
diff --git a/plugins-scripts/check_breeze.pl b/plugins-scripts/check_breeze.pl
new file mode 100755
index 00000000..79e36be7
--- /dev/null
+++ b/plugins-scripts/check_breeze.pl
@@ -0,0 +1,86 @@
1#! /usr/bin/perl -wT
2
3BEGIN {
4 if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) {
5 $runtimedir = $1;
6 $PROGNAME = $2;
7 }
8}
9
10use strict;
11use Getopt::Long;
12use vars qw($opt_V $opt_h $opt_H $opt_w $opt_c $PROGNAME);
13use lib $main::runtimedir;
14use utils qw(%ERRORS &print_revision &support &usage);
15
16sub print_help ();
17sub print_usage ();
18
19$ENV{'PATH'}='';
20$ENV{'BASH_ENV'}='';
21$ENV{'ENV'}='';
22
23Getopt::Long::Configure('bundling');
24GetOptions
25 ("V" => \$opt_V, "version" => \$opt_V,
26 "h" => \$opt_h, "help" => \$opt_h,
27 "w=s" => \$opt_w, "warning=s" => \$opt_w,
28 "c=s" => \$opt_c, "critical=s" => \$opt_c,
29 "H=s" => \$opt_H, "hostname=s" => \$opt_H);
30
31if ($opt_V) {
32 print_revision($PROGNAME,'$Revision$');
33 exit $ERRORS{'OK'};
34}
35
36if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
37
38($opt_H) || ($opt_H = shift) || usage("Host name/address not specified\n");
39my $host = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);
40($host) || usage("Invalid host: $opt_H\n");
41
42($opt_w) || ($opt_w = shift) || usage("Warning threshold not specified\n");
43my $warning = $1 if ($opt_w =~ /([0-9]{1,2}|100)+/);
44($warning) || usage("Invalid warning threshold: $opt_w\n");
45
46($opt_c) || ($opt_c = shift) || usage("Critical threshold not specified\n");
47my $critical = $1 if ($opt_c =~ /([0-9]{1,2}|100)/);
48($critical) || usage("Invalid critical threshold: $opt_c\n");
49
50my $sig=0;
51$sig = `/usr/bin/snmpget $host public .1.3.6.1.4.1.710.3.2.3.1.3.0`;
52my @test=split(/ /,$sig);
53$sig=$test[2];
54$sig=int($sig);
55if ($sig>100){$sig=100}
56
57print "Signal Strength at: $sig%\n";
58
59exit $ERRORS{'CRITICAL'} if ($sig<$critical);
60exit $ERRORS{'WARNING'} if ($sig<$warning);
61exit $ERRORS{'OK'};
62
63
64sub print_usage () {
65 print "Usage: $PROGNAME -H <host> -w <warn> -c <crit>\n";
66}
67
68sub print_help () {
69 print_revision($PROGNAME,'$Revision$');
70 print "Copyright (c) 2000 Jeffrey Blank/Karl DeBisschop
71
72This plugin reports the signal strength of a Breezecom wireless equipment
73
74";
75 print_usage();
76 print "
77-H, --hostname=HOST
78 Name or IP address of host to check
79-w, --warning=INTEGER
80 Percentage strength below which a WARNING status will result
81-c, --critical=INTEGER
82 Percentage strength below which a CRITICAL status will result
83
84";
85 support();
86}