summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e808128)
raw | patch | inline | side by side (parent: e808128)
author | Subhendu Ghosh <sghosh@users.sourceforge.net> | |
Wed, 5 Nov 2003 22:59:41 +0000 (22:59 +0000) | ||
committer | Subhendu Ghosh <sghosh@users.sourceforge.net> | |
Wed, 5 Nov 2003 22:59:41 +0000 (22:59 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@758 f882894a-f735-0410-b71e-b25c423dba1c
plugins-scripts/check_ifoperstatus.pl | patch | blob | history | |
plugins-scripts/check_ifstatus.pl | patch | blob | history |
index 8a23ca5eab902d1372ab6bae0d639028d83717a6..a43e9f4d2fa7eae98089e77a4914a82dbbde4eb3 100644 (file)
sub usage ();
sub process_arguments ();
+my $timeout;
my $status;
my %ifOperStatus = ('1','up',
'2','down',
my $dormantWarn;
my $name;
+### Validate Arguments
+
+$status = process_arguments();
# Just in case of problems, let's not hang Nagios
print ("ERROR: No snmp response from $hostname (alarm)\n");
exit $ERRORS{"UNKNOWN"};
};
-alarm($TIMEOUT);
-
-
-### Validate Arguments
-$status = process_arguments();
+alarm($timeout);
## map ifdescr to ifindex - should look at being able to cache this value
printf " (Implies the use of -I)\n";
printf " -w (--warn =i|w|c) ignore|warn|crit if the interface is dormant (default critical)\n";
printf " -M (--maxmsgsize) Max message size - usefull only for v1 or v2c\n";
+ printf " -t (--timeout) seconds before the plugin times out (default=$TIMEOUT)\n";
printf " -V (--version) Plugin version\n";
printf " -h (--help) usage help \n\n";
printf " -k or -d must be specified\n\n";
"k=i" => \$snmpkey, "key=i",\$snmpkey,
"d=s" => \$ifdescr, "descr=s" => \$ifdescr,
"l=s" => \$lastc, "lastchange=s" => \$lastc,
- "p=i" = >\$port, "port=i" =>\$port,
+ "p=i" => \$port, "port=i" =>\$port,
"H=s" => \$hostname, "hostname=s" => \$hostname,
"I" => \$ifXTable, "ifmib" => \$ifXTable,
"n=s" => \$ifName, "name=s" => \$ifName,
"w=s" => \$dormantWarn, "warn=s" => \$dormantWarn,
- "M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize);
+ "M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize,
+ "t=i" => \$timeout, "timeout=i" => \$timeout,
+ );
}
}
+ unless (defined $timeout) {
+ $timeout = $TIMEOUT;
+ }
+
if ($snmp_version =~ /3/ ) {
# Must define a security level even though default is noAuthNoPriv
# v3 requires a security username
index 4f17711680770bdaaf4fdaaa1367ca3a72e8d632..7452394d33faf58a5d98093c12510aad55d6205a 100755 (executable)
'6','notPresent',
'7','lowerLayerDown'); # down due to the state of lower layer interface(s));
+my $timeout ;
my $state = "UNKNOWN";
my $answer = "";
my $snmpkey=0;
}
-alarm($TIMEOUT);
+alarm($timeout);
push(@snmpoids,$snmpIfOperStatus);
push(@snmpoids,$snmpIfAdminStatus);
printf " in hex with 0x prefix generated by using \"snmpkey\" utility\n";
printf " privacy password and authEngineID\n";
printf " -M (--maxmsgsize) Max message size - usefull only for v1 or v2c\n";
+ printf " -t (--timeout) seconds before the plugin times out (default=$TIMEOUT)\n";
printf " -V (--version) Plugin version\n";
printf " -h (--help) usage help \n\n";
print_revision($PROGNAME, '$Revision$');
"I" => \$ifXTable, "ifmib" => \$ifXTable,
"x:s" => \$opt_x, "exclude:s" => \$opt_x,
"u=s" => \$opt_u, "unused_ports=s" => \$opt_u,
- "M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize);
+ "M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize,
+ "t=i" => \$timeout, "timeout=i" => \$timeout,
+ );
if ($status == 0){
print_help() ;
exit $ERRORS{'OK'};
}
+ unless (defined $timeout) {
+ $timeout = $TIMEOUT;
+ }
if ($snmp_version =~ /3/ ) {
# Must define a security level even though default is noAuthNoPriv