3
# $Id: check_wave.pl,v 1.4 2002/10/28 13:05:08 kdebisschop Exp $
8
use utils qw($TIMEOUT %ERRORS &print_revision &support);
9
use vars qw($PROGNAME);
11
use vars qw($opt_V $opt_h $verbose $opt_w $opt_c $opt_H);
12
my (@test, $low1, $med1, $high1, $snr, $low2, $med2, $high2);
13
my ($low, $med, $high, $lowavg, $medavg, $highavg, $tot, $ss);
15
$PROGNAME = "check_wave";
23
Getopt::Long::Configure('bundling');
25
("V" => \$opt_V, "version" => \$opt_V,
26
"h" => \$opt_h, "help" => \$opt_h,
27
"v" => \$verbose, "verbose" => \$verbose,
28
"w=s" => \$opt_w, "warning=s" => \$opt_w,
29
"c=s" => \$opt_c, "critical=s" => \$opt_c,
30
"H=s" => \$opt_H, "hostname=s" => \$opt_H);
33
print_revision($PROGNAME,'$Revision: 1.4 $'); #'
42
$opt_H = shift unless ($opt_H);
43
print_usage() unless ($opt_H);
44
my $host = $1 if ($opt_H =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0]+(\.[a-zA-Z][-a-zA-Z0]+)*)$/);
45
print_usage() unless ($host);
47
($opt_c) || ($opt_c = shift) || ($opt_c = 120);
48
my $critical = $1 if ($opt_c =~ /([0-9]+)/);
50
($opt_w) || ($opt_w = shift) || ($opt_w = 60);
51
my $warning = $1 if ($opt_w =~ /([0-9]+)/);
53
$low1 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.8.1`;
54
@test = split(/ /,$low1);
57
$med1 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.9.1`;
58
@test = split(/ /,$med1);
61
$high1 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.10.1`;
62
@test = split(/ /,$high1);
67
$snr = `snmpget $host public .1.3.6.1.4.1.762.2.5.2.1.17.1`;
68
@test = split(/ /,$snr);
72
$low2 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.8.1`;
73
@test = split(/ /,$low2);
76
$med2 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.9.1`;
77
@test = split(/ /,$med2);
80
$high2 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.10.1`;
81
@test = split(/ /,$high2);
86
$high = $high2 - $high1;
88
$tot = $low + $med + $high;
93
$lowavg = $low / $tot;
94
$medavg = $med / $tot;
95
$highavg = $high / $tot;
96
$ss = ($medavg*50) + ($highavg*100);
99
printf("Signal Strength at: %3.0f%, SNR at $snr%",$ss);
103
} elsif ($ss<$warning) {
111
print "Usage: $PROGNAME -H <host> [-w <warn>] [-c <crit>]\n";
115
print_revision($PROGNAME,'$Revision: 1.4 $');
116
print "Copyright (c) 2000 Jeffery Blank/Karl DeBisschop\n";
120
print "<warn> = Signal strength at which a warning message will be generated.\n";
121
print "<crit> = Signal strength at which a critical message will be generated.\n\n";