Merge remote-tracking branch 'upstream/pr/1456'
[monitoring-plugins.git] / plugins-scripts / check_breeze.pl
blob05b9920369e2d2248a890a13129abf094593df06
1 #!@PERL@ -w
4 use strict;
5 use Getopt::Long;
6 use vars qw($opt_V $opt_h $opt_w $opt_c $opt_H $opt_C $PROGNAME);
7 use FindBin;
8 use lib "$FindBin::Bin";
9 use utils qw(%ERRORS &print_revision &support &usage);
11 $PROGNAME = "check_breeze";
13 sub print_help ();
14 sub print_usage ();
16 $ENV{'PATH'}='@TRUSTED_PATH@';
17 $ENV{'BASH_ENV'}='';
18 $ENV{'ENV'}='';
20 Getopt::Long::Configure('bundling');
21 GetOptions
22 ("V" => \$opt_V, "version" => \$opt_V,
23 "h" => \$opt_h, "help" => \$opt_h,
24 "w=s" => \$opt_w, "warning=s" => \$opt_w,
25 "c=s" => \$opt_c, "critical=s" => \$opt_c,
26 "H=s" => \$opt_H, "hostname=s" => \$opt_H,
27 "C=s" => \$opt_C, "community=s" => \$opt_C);
29 if ($opt_V) {
30 print_revision($PROGNAME,'@NP_VERSION@');
31 exit $ERRORS{'UNKNOWN'};
34 if ($opt_h) {print_help(); exit $ERRORS{'UNKNOWN'};}
36 ($opt_H) || usage("Host name/address not specified\n");
37 my $host = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);
38 ($host) || usage("Invalid host: $opt_H\n");
40 ($opt_w) || usage("Warning threshold not specified\n");
41 my $warning = $1 if ($opt_w =~ /([0-9]{1,2}|100)+/);
42 ($warning) || usage("Invalid warning threshold: $opt_w\n");
44 ($opt_c) || usage("Critical threshold not specified\n");
45 my $critical = $1 if ($opt_c =~ /([0-9]{1,2}|100)/);
46 ($critical) || usage("Invalid critical threshold: $opt_c\n");
48 ($opt_C) || ($opt_C = "public") ;
50 my $sig=0;
51 $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);
53 $sig=$test[2];
54 $sig=int($sig);
55 if ($sig>100){$sig=100}
57 print "Signal Strength at: $sig%\n";
59 exit $ERRORS{'CRITICAL'} if ($sig<$critical);
60 exit $ERRORS{'WARNING'} if ($sig<$warning);
61 exit $ERRORS{'OK'};
64 sub print_usage () {
65 print "Usage: $PROGNAME -H <host> [-C community] -w <warn> -c <crit>\n";
68 sub print_help () {
69 print_revision($PROGNAME,'@NP_VERSION@');
70 print "Copyright (c) 2000 Jeffrey Blank/Karl DeBisschop
72 This plugin reports the signal strength of a Breezecom wireless equipment
75 print_usage();
76 print "
77 -H, --hostname=HOST
78 Name or IP address of host to check
79 -C, --community=community
80 SNMPv1 community (default public)
81 -w, --warning=INTEGER
82 Percentage strength below which a WARNING status will result
83 -c, --critical=INTEGER
84 Percentage strength below which a CRITICAL status will result
87 support();