Merge branch 'master' of ssh://tonvoon@nagiosplug.git.sourceforge.net/gitroot/nagiosp...
[monitoring-plugins.git] / plugins-scripts / check_breeze.pl
bloba4e8542cbe8ca3c4986b8653e636c28262c3570e
1 #!/usr/bin/perl -wT
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 lib utils.pm ;
8 use utils qw(%ERRORS &print_revision &support &usage);
10 $PROGNAME = "check_breeze";
12 sub print_help ();
13 sub print_usage ();
15 $ENV{'PATH'}='';
16 $ENV{'BASH_ENV'}='';
17 $ENV{'ENV'}='';
19 Getopt::Long::Configure('bundling');
20 GetOptions
21 ("V" => \$opt_V, "version" => \$opt_V,
22 "h" => \$opt_h, "help" => \$opt_h,
23 "w=s" => \$opt_w, "warning=s" => \$opt_w,
24 "c=s" => \$opt_c, "critical=s" => \$opt_c,
25 "H=s" => \$opt_H, "hostname=s" => \$opt_H,
26 "C=s" => \$opt_C, "community=s" => \$opt_C);
28 if ($opt_V) {
29 print_revision($PROGNAME,'@NP_VERSION@');
30 exit $ERRORS{'OK'};
33 if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
35 ($opt_H) || usage("Host name/address not specified\n");
36 my $host = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);
37 ($host) || usage("Invalid host: $opt_H\n");
39 ($opt_w) || usage("Warning threshold not specified\n");
40 my $warning = $1 if ($opt_w =~ /([0-9]{1,2}|100)+/);
41 ($warning) || usage("Invalid warning threshold: $opt_w\n");
43 ($opt_c) || usage("Critical threshold not specified\n");
44 my $critical = $1 if ($opt_c =~ /([0-9]{1,2}|100)/);
45 ($critical) || usage("Invalid critical threshold: $opt_c\n");
47 ($opt_C) || ($opt_C = "public") ;
49 my $sig=0;
50 $sig = `/usr/bin/snmpget $host $opt_C .1.3.6.1.4.1.710.3.2.3.1.3.0`;
51 my @test=split(/ /,$sig);
52 $sig=$test[2];
53 $sig=int($sig);
54 if ($sig>100){$sig=100}
56 print "Signal Strength at: $sig%\n";
58 exit $ERRORS{'CRITICAL'} if ($sig<$critical);
59 exit $ERRORS{'WARNING'} if ($sig<$warning);
60 exit $ERRORS{'OK'};
63 sub print_usage () {
64 print "Usage: $PROGNAME -H <host> [-C community] -w <warn> -c <crit>\n";
67 sub print_help () {
68 print_revision($PROGNAME,'@NP_VERSION@');
69 print "Copyright (c) 2000 Jeffrey Blank/Karl DeBisschop
71 This plugin reports the signal strength of a Breezecom wireless equipment
74 print_usage();
75 print "
76 -H, --hostname=HOST
77 Name or IP address of host to check
78 -C, --community=community
79 SNMPv1 community (default public)
80 -w, --warning=INTEGER
81 Percentage strength below which a WARNING status will result
82 -c, --critical=INTEGER
83 Percentage strength below which a CRITICAL status will result
86 support();