summaryrefslogtreecommitdiffstats
path: root/plugins-scripts/check_ifoperstatus.pl
diff options
context:
space:
mode:
Diffstat (limited to 'plugins-scripts/check_ifoperstatus.pl')
-rwxr-xr-xplugins-scripts/check_ifoperstatus.pl11
1 files changed, 5 insertions, 6 deletions
diff --git a/plugins-scripts/check_ifoperstatus.pl b/plugins-scripts/check_ifoperstatus.pl
index cf2c7b58..c190ce95 100755
--- a/plugins-scripts/check_ifoperstatus.pl
+++ b/plugins-scripts/check_ifoperstatus.pl
@@ -37,7 +37,6 @@ use POSIX;
37use strict; 37use strict;
38use FindBin; 38use FindBin;
39use lib "$FindBin::Bin"; 39use lib "$FindBin::Bin";
40use lib '@libexecdir@';
41use utils qw($TIMEOUT %ERRORS &print_revision &support); 40use utils qw($TIMEOUT %ERRORS &print_revision &support);
42 41
43use Net::SNMP; 42use Net::SNMP;
@@ -125,10 +124,10 @@ if (!defined($session)) {
125## map ifdescr to ifindex - should look at being able to cache this value 124## map ifdescr to ifindex - should look at being able to cache this value
126 125
127if (defined $ifdescr || defined $iftype) { 126if (defined $ifdescr || defined $iftype) {
128 # escape "/" in ifdescr - very common in the Cisco world
129 if (defined $iftype) { 127 if (defined $iftype) {
130 $status=fetch_ifindex($snmpIfType, $iftype); 128 $status=fetch_ifindex($snmpIfType, $iftype);
131 } else { 129 } else {
130 # escape "/" in ifdescr - very common in the Cisco world
132 $ifdescr =~ s/\//\\\//g; 131 $ifdescr =~ s/\//\\\//g;
133 $status=fetch_ifindex($snmpIfDescr, $ifdescr); # if using on device with large number of interfaces 132 $status=fetch_ifindex($snmpIfDescr, $ifdescr); # if using on device with large number of interfaces
134 # recommend use of SNMP v2 (get-bulk) 133 # recommend use of SNMP v2 (get-bulk)
@@ -326,7 +325,7 @@ sub print_help() {
326 printf " (Implies the use of -I)\n"; 325 printf " (Implies the use of -I)\n";
327 printf " -w (--warn =i|w|c) ignore|warn|crit if the interface is dormant (default critical)\n"; 326 printf " -w (--warn =i|w|c) ignore|warn|crit if the interface is dormant (default critical)\n";
328 printf " -D (--admin-down =i|w|c) same for administratively down interfaces (default warning)\n"; 327 printf " -D (--admin-down =i|w|c) same for administratively down interfaces (default warning)\n";
329 printf " -M (--maxmsgsize) Max message size - usefull only for v1 or v2c\n"; 328 printf " -M (--maxmsgsize) Max message size - useful only for v1 or v2c\n";
330 printf " -t (--timeout) seconds before the plugin times out (default=$TIMEOUT)\n"; 329 printf " -t (--timeout) seconds before the plugin times out (default=$TIMEOUT)\n";
331 printf " -V (--version) Plugin version\n"; 330 printf " -V (--version) Plugin version\n";
332 printf " -h (--help) usage help \n\n"; 331 printf " -h (--help) usage help \n\n";
@@ -368,17 +367,17 @@ sub process_arguments() {
368 367
369 if ($status == 0){ 368 if ($status == 0){
370 print_help(); 369 print_help();
371 exit $ERRORS{'OK'}; 370 exit $ERRORS{'UNKNOWN'};
372 } 371 }
373 372
374 if ($opt_V) { 373 if ($opt_V) {
375 print_revision($PROGNAME,'@NP_VERSION@'); 374 print_revision($PROGNAME,'@NP_VERSION@');
376 exit $ERRORS{'OK'}; 375 exit $ERRORS{'UNKNOWN'};
377 } 376 }
378 377
379 if ($opt_h) { 378 if ($opt_h) {
380 print_help(); 379 print_help();
381 exit $ERRORS{'OK'}; 380 exit $ERRORS{'UNKNOWN'};
382 } 381 }
383 382
384 if (! utils::is_hostname($hostname)){ 383 if (! utils::is_hostname($hostname)){