diff options
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', | |||
| 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 | ||
| 59 | my $timeout ; | ||
| 59 | my $state = "UNKNOWN"; | 60 | my $state = "UNKNOWN"; |
| 60 | my $answer = ""; | 61 | my $answer = ""; |
| 61 | my $snmpkey=0; | 62 | my $snmpkey=0; |
| @@ -114,7 +115,7 @@ if ($status != 0) | |||
| 114 | } | 115 | } |
| 115 | 116 | ||
| 116 | 117 | ||
| 117 | alarm($TIMEOUT); | 118 | alarm($timeout); |
| 118 | 119 | ||
| 119 | push(@snmpoids,$snmpIfOperStatus); | 120 | push(@snmpoids,$snmpIfOperStatus); |
| 120 | push(@snmpoids,$snmpIfAdminStatus); | 121 | push(@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 |
