diff options
Diffstat (limited to 'plugins-scripts/check_breeze.pl')
-rwxr-xr-x | plugins-scripts/check_breeze.pl | 86 |
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 0000000..79e36be --- /dev/null +++ b/plugins-scripts/check_breeze.pl | |||
@@ -0,0 +1,86 @@ | |||
1 | #! /usr/bin/perl -wT | ||
2 | |||
3 | BEGIN { | ||
4 | if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) { | ||
5 | $runtimedir = $1; | ||
6 | $PROGNAME = $2; | ||
7 | } | ||
8 | } | ||
9 | |||
10 | use strict; | ||
11 | use Getopt::Long; | ||
12 | use vars qw($opt_V $opt_h $opt_H $opt_w $opt_c $PROGNAME); | ||
13 | use lib $main::runtimedir; | ||
14 | use utils qw(%ERRORS &print_revision &support &usage); | ||
15 | |||
16 | sub print_help (); | ||
17 | sub print_usage (); | ||
18 | |||
19 | $ENV{'PATH'}=''; | ||
20 | $ENV{'BASH_ENV'}=''; | ||
21 | $ENV{'ENV'}=''; | ||
22 | |||
23 | Getopt::Long::Configure('bundling'); | ||
24 | GetOptions | ||
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 | |||
31 | if ($opt_V) { | ||
32 | print_revision($PROGNAME,'$Revision$'); | ||
33 | exit $ERRORS{'OK'}; | ||
34 | } | ||
35 | |||
36 | if ($opt_h) {print_help(); exit $ERRORS{'OK'};} | ||
37 | |||
38 | ($opt_H) || ($opt_H = shift) || usage("Host name/address not specified\n"); | ||
39 | my $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"); | ||
43 | my $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"); | ||
47 | my $critical = $1 if ($opt_c =~ /([0-9]{1,2}|100)/); | ||
48 | ($critical) || usage("Invalid critical threshold: $opt_c\n"); | ||
49 | |||
50 | my $sig=0; | ||
51 | $sig = `/usr/bin/snmpget $host public .1.3.6.1.4.1.710.3.2.3.1.3.0`; | ||
52 | my @test=split(/ /,$sig); | ||
53 | $sig=$test[2]; | ||
54 | $sig=int($sig); | ||
55 | if ($sig>100){$sig=100} | ||
56 | |||
57 | print "Signal Strength at: $sig%\n"; | ||
58 | |||
59 | exit $ERRORS{'CRITICAL'} if ($sig<$critical); | ||
60 | exit $ERRORS{'WARNING'} if ($sig<$warning); | ||
61 | exit $ERRORS{'OK'}; | ||
62 | |||
63 | |||
64 | sub print_usage () { | ||
65 | print "Usage: $PROGNAME -H <host> -w <warn> -c <crit>\n"; | ||
66 | } | ||
67 | |||
68 | sub print_help () { | ||
69 | print_revision($PROGNAME,'$Revision$'); | ||
70 | print "Copyright (c) 2000 Jeffrey Blank/Karl DeBisschop | ||
71 | |||
72 | This 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 | } | ||