683d68d763
from pkgsrc-wip. This is a package for the SNMP monitoring plug-ins for nagios. For more information about nagios, see the 'nagios-base' package.
81 lines
2.8 KiB
Text
81 lines
2.8 KiB
Text
$NetBSD: patch-ae,v 1.1.1.1 2006/02/18 17:23:43 bouyer Exp $
|
|
|
|
--- plugins-scripts/check_wave.pl.orig 2002-10-28 05:05:08.000000000 -0800
|
|
+++ plugins-scripts/check_wave.pl 2005-08-10 13:50:01.000000000 -0700
|
|
@@ -8,7 +8,7 @@
|
|
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
|
use vars qw($PROGNAME);
|
|
use Getopt::Long;
|
|
-use vars qw($opt_V $opt_h $verbose $opt_w $opt_c $opt_H);
|
|
+use vars qw($opt_V $opt_h $verbose $opt_w $opt_c $opt_H $opt_C);
|
|
my (@test, $low1, $med1, $high1, $snr, $low2, $med2, $high2);
|
|
my ($low, $med, $high, $lowavg, $medavg, $highavg, $tot, $ss);
|
|
|
|
@@ -27,6 +27,7 @@
|
|
"v" => \$verbose, "verbose" => \$verbose,
|
|
"w=s" => \$opt_w, "warning=s" => \$opt_w,
|
|
"c=s" => \$opt_c, "critical=s" => \$opt_c,
|
|
- "H=s" => \$opt_H, "hostname=s" => \$opt_H);
|
|
+ "H=s" => \$opt_H, "hostname=s" => \$opt_H,
|
|
+ "C=s" => \$opt_C, "community=s" => \$opt_C);
|
|
|
|
if ($opt_V) {
|
|
@@ -40,6 +41,7 @@
|
|
}
|
|
|
|
$opt_H = shift unless ($opt_H);
|
|
+$opt_C = "public" unless ($opt_C);
|
|
print_usage() unless ($opt_H);
|
|
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]+)*)$/);
|
|
print_usage() unless ($host);
|
|
@@ -50,34 +52,34 @@
|
|
($opt_w) || ($opt_w = shift) || ($opt_w = 60);
|
|
my $warning = $1 if ($opt_w =~ /([0-9]+)/);
|
|
|
|
-$low1 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.8.1`;
|
|
+$low1 = `$utils::PATH_TO_SNMPGET -c $opt_C $host .1.3.6.1.4.1.74.2.21.1.2.1.8.1`;
|
|
@test = split(/ /,$low1);
|
|
$low1 = $test[2];
|
|
|
|
-$med1 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.9.1`;
|
|
+$med1 = `$utils::PATH_TO_SNMPGET -c $opt_C $host .1.3.6.1.4.1.74.2.21.1.2.1.9.1`;
|
|
@test = split(/ /,$med1);
|
|
$med1 = $test[2];
|
|
|
|
-$high1 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.10.1`;
|
|
+$high1 = `$utils::PATH_TO_SNMPGET -c $opt_C $host .1.3.6.1.4.1.74.2.21.1.2.1.10.1`;
|
|
@test = split(/ /,$high1);
|
|
$high1 = $test[2];
|
|
|
|
sleep(2);
|
|
|
|
-$snr = `snmpget $host public .1.3.6.1.4.1.762.2.5.2.1.17.1`;
|
|
+$snr = `$utils::PATH_TO_SNMPGET -c $opt_C $host .1.3.6.1.4.1.762.2.5.2.1.17.1`;
|
|
@test = split(/ /,$snr);
|
|
$snr = $test[2];
|
|
$snr = int($snr*25);
|
|
|
|
-$low2 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.8.1`;
|
|
+$low2 = `$utils::PATH_TO_SNMPGET -c $opt_C $host .1.3.6.1.4.1.74.2.21.1.2.1.8.1`;
|
|
@test = split(/ /,$low2);
|
|
$low2 = $test[2];
|
|
|
|
-$med2 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.9.1`;
|
|
+$med2 = `$utils::PATH_TO_SNMPGET -c $opt_C $host .1.3.6.1.4.1.74.2.21.1.2.1.9.1`;
|
|
@test = split(/ /,$med2);
|
|
$med2 = $test[2];
|
|
|
|
-$high2 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.10.1`;
|
|
+$high2 = `$utils::PATH_TO_SNMPGET -c $opt_C $host .1.3.6.1.4.1.74.2.21.1.2.1.10.1`;
|
|
@test = split(/ /,$high2);
|
|
$high2 = $test[2];
|
|
|
|
@@ -108,7 +110,7 @@
|
|
|
|
|
|
sub print_usage () {
|
|
- print "Usage: $PROGNAME -H <host> [-w <warn>] [-c <crit>]\n";
|
|
+ print "Usage: $PROGNAME -H <host> [-C <community>] [-w <warn>] [-c <crit>]\n";
|
|
}
|
|
|
|
sub print_help () {
|