diff options
author | Subhendu Ghosh <sghosh@users.sourceforge.net> | 2003-11-05 22:59:41 +0000 |
---|---|---|
committer | Subhendu Ghosh <sghosh@users.sourceforge.net> | 2003-11-05 22:59:41 +0000 |
commit | 62d93550ea39333c09daeb12b5c91718b2149b4c (patch) | |
tree | 51a0a59290b0980e705df30d9a15ef872172ae7f /plugins-scripts/check_ifstatus.pl | |
parent | e8081286665b8cfe16a4fafdee935bdef4536a4f (diff) | |
download | monitoring-plugins-62d93550ea39333c09daeb12b5c91718b2149b4c.tar.gz |
added plugin timeout options
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@758 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins-scripts/check_ifstatus.pl')
-rwxr-xr-x | plugins-scripts/check_ifstatus.pl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins-scripts/check_ifstatus.pl b/plugins-scripts/check_ifstatus.pl index 4f177116..7452394d 100755 --- a/plugins-scripts/check_ifstatus.pl +++ b/plugins-scripts/check_ifstatus.pl @@ -56,6 +56,7 @@ my %ifOperStatus = ('1','up', '6','notPresent', '7','lowerLayerDown'); # down due to the state of lower layer interface(s)); +my $timeout ; my $state = "UNKNOWN"; my $answer = ""; my $snmpkey=0; @@ -114,7 +115,7 @@ if ($status != 0) } -alarm($TIMEOUT); +alarm($timeout); push(@snmpoids,$snmpIfOperStatus); push(@snmpoids,$snmpIfAdminStatus); @@ -251,6 +252,7 @@ sub print_help (){ 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$'); @@ -274,7 +276,9 @@ sub process_arguments() { "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() ; @@ -290,6 +294,9 @@ sub process_arguments() { exit $ERRORS{'OK'}; } + unless (defined $timeout) { + $timeout = $TIMEOUT; + } if ($snmp_version =~ /3/ ) { # Must define a security level even though default is noAuthNoPriv |