summaryrefslogtreecommitdiffstats
path: root/plugins-scripts/check_ifstatus.pl
diff options
context:
space:
mode:
Diffstat (limited to 'plugins-scripts/check_ifstatus.pl')
-rwxr-xr-xplugins-scripts/check_ifstatus.pl11
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',
56 '6','notPresent', 56 '6','notPresent',
57 '7','lowerLayerDown'); # down due to the state of lower layer interface(s)); 57 '7','lowerLayerDown'); # down due to the state of lower layer interface(s));
58 58
59my $timeout ;
59my $state = "UNKNOWN"; 60my $state = "UNKNOWN";
60my $answer = ""; 61my $answer = "";
61my $snmpkey=0; 62my $snmpkey=0;
@@ -114,7 +115,7 @@ if ($status != 0)
114} 115}
115 116
116 117
117alarm($TIMEOUT); 118alarm($timeout);
118 119
119push(@snmpoids,$snmpIfOperStatus); 120push(@snmpoids,$snmpIfOperStatus);
120push(@snmpoids,$snmpIfAdminStatus); 121push(@snmpoids,$snmpIfAdminStatus);
@@ -251,6 +252,7 @@ sub print_help (){
251 printf " in hex with 0x prefix generated by using \"snmpkey\" utility\n"; 252 printf " in hex with 0x prefix generated by using \"snmpkey\" utility\n";
252 printf " privacy password and authEngineID\n"; 253 printf " privacy password and authEngineID\n";
253 printf " -M (--maxmsgsize) Max message size - usefull only for v1 or v2c\n"; 254 printf " -M (--maxmsgsize) Max message size - usefull only for v1 or v2c\n";
255 printf " -t (--timeout) seconds before the plugin times out (default=$TIMEOUT)\n";
254 printf " -V (--version) Plugin version\n"; 256 printf " -V (--version) Plugin version\n";
255 printf " -h (--help) usage help \n\n"; 257 printf " -h (--help) usage help \n\n";
256 print_revision($PROGNAME, '$Revision$'); 258 print_revision($PROGNAME, '$Revision$');
@@ -274,7 +276,9 @@ sub process_arguments() {
274 "I" => \$ifXTable, "ifmib" => \$ifXTable, 276 "I" => \$ifXTable, "ifmib" => \$ifXTable,
275 "x:s" => \$opt_x, "exclude:s" => \$opt_x, 277 "x:s" => \$opt_x, "exclude:s" => \$opt_x,
276 "u=s" => \$opt_u, "unused_ports=s" => \$opt_u, 278 "u=s" => \$opt_u, "unused_ports=s" => \$opt_u,
277 "M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize); 279 "M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize,
280 "t=i" => \$timeout, "timeout=i" => \$timeout,
281 );
278 282
279 if ($status == 0){ 283 if ($status == 0){
280 print_help() ; 284 print_help() ;
@@ -290,6 +294,9 @@ sub process_arguments() {
290 exit $ERRORS{'OK'}; 294 exit $ERRORS{'OK'};
291 } 295 }
292 296
297 unless (defined $timeout) {
298 $timeout = $TIMEOUT;
299 }
293 300
294 if ($snmp_version =~ /3/ ) { 301 if ($snmp_version =~ /3/ ) {
295 # Must define a security level even though default is noAuthNoPriv 302 # Must define a security level even though default is noAuthNoPriv