7 use lib
"$FindBin::Bin";
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";
19 $ENV{'PATH'}='@TRUSTED_PATH@';
24 Getopt::Long::Configure('bundling');
26 ("V" => \$opt_V, "version" => \$opt_V,
27 "h" => \$opt_h, "help" => \$opt_h,
28 "v" => \$verbose, "verbose" => \$verbose,
29 "w=s" => \$opt_w, "warning=s" => \$opt_w,
30 "c=s" => \$opt_c, "critical=s" => \$opt_c,
31 "H=s" => \$opt_H, "hostname=s" => \$opt_H);
34 print_revision($PROGNAME,'@NP_VERSION@'); #'
35 exit $ERRORS{'UNKNOWN'};
40 exit $ERRORS{'UNKNOWN'};
43 $opt_H = shift unless ($opt_H);
44 print_usage() unless ($opt_H);
45 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]+)*)$/);
46 print_usage() unless ($host);
48 ($opt_c) || ($opt_c = shift) || ($opt_c = 120);
49 my $critical = $1 if ($opt_c =~ /([0-9]+)/);
51 ($opt_w) || ($opt_w = shift) || ($opt_w = 60);
52 my $warning = $1 if ($opt_w =~ /([0-9]+)/);
54 $low1 = `$utils::PATH_TO_SNMPGET $host public .1.3.6.1.4.1.74.2.21.1.2.1.8.1`;
55 @test = split(/ /,$low1);
58 $med1 = `$utils::PATH_TO_SNMPGET $host public .1.3.6.1.4.1.74.2.21.1.2.1.9.1`;
59 @test = split(/ /,$med1);
62 $high1 = `$utils::PATH_TO_SNMPGET $host public .1.3.6.1.4.1.74.2.21.1.2.1.10.1`;
63 @test = split(/ /,$high1);
68 $snr = `$utils::PATH_TO_SNMPGET $host public .1.3.6.1.4.1.762.2.5.2.1.17.1`;
69 @test = split(/ /,$snr);
73 $low2 = `$utils::PATH_TO_SNMPGET $host public .1.3.6.1.4.1.74.2.21.1.2.1.8.1`;
74 @test = split(/ /,$low2);
77 $med2 = `$utils::PATH_TO_SNMPGET $host public .1.3.6.1.4.1.74.2.21.1.2.1.9.1`;
78 @test = split(/ /,$med2);
81 $high2 = `$utils::PATH_TO_SNMPGET $host public .1.3.6.1.4.1.74.2.21.1.2.1.10.1`;
82 @test = split(/ /,$high2);
87 $high = $high2 - $high1;
89 $tot = $low + $med + $high;
94 $lowavg = $low / $tot;
95 $medavg = $med / $tot;
96 $highavg = $high / $tot;
97 $ss = ($medavg*50) + ($highavg*100);
100 printf("Signal Strength at: %3.0f%, SNR at $snr%",$ss);
104 } elsif ($ss<$warning) {
112 print "Usage: $PROGNAME -H <host> [-w <warn>] [-c <crit>]\n";
116 print_revision($PROGNAME,'@NP_VERSION@');
117 print "Copyright (c) 2000 Jeffery Blank/Karl DeBisschop\n";
121 print "<warn> = Signal strength at which a warning message will be generated.\n";
122 print "<crit> = Signal strength at which a critical message will be generated.\n\n";