[Nagiosplug-help] patch for check_ifoperstatus

Hugo Lombard hal at infosat.net
Mon Jun 9 04:03:08 CEST 2003


This patch adds the -a/--adminwarn option, allowing one to ignore or
mark as critical interfaces that are administratively down.


--- check_ifoperstatus	Mon Jun  9 11:44:16 2003
+++ /tmp/check_ifoperstatus	Mon Jun  9 12:57:02 2003
@@ -79,6 +79,7 @@
 my $lastc;
 my $dormantWarn;
 my $name;
+my $admindownWarn;
 
 
 
@@ -104,7 +105,8 @@
 			"H=s" => \$hostname, "hostname=s" => \$hostname,
 			"I"	  => \$ifXTable, "ifmib" => \$ifXTable,
 			"n=s" => \$ifName, "name=s" => \$ifName,
-			"w=s" => \$dormantWarn, "warn=s" => \$dormantWarn );
+			"w=s" => \$dormantWarn, "warn=s" => \$dormantWarn,
+			"a=s" => \$admindownWarn, "adminwarn=s" => \$admindownWarn );
 
 
 				
@@ -235,8 +237,18 @@
    ## if AdminStatus is down - some one made a consious effort to change config
    ##
    if ( not ($response->{$snmpIfAdminStatus} == 1) ) {
-      $state = 'WARNING';
-      $answer = "Interface $name (index $snmpkey) is administratively down.";
+      if (defined $admindownWarn ) {
+         if ($admindownWarn eq "c") {
+            $state = 'CRITICAL';
+            $answer = "Interface $name (index $snmpkey) is administratively down.";
+         }elsif($admindownWarn eq"i") {
+            $state = 'OK';
+            $answer = "Interface $name (index $snmpkey) is administratively down.";
+         }
+      }else{
+         $state = 'WARNING';
+         $answer = "Interface $name (index $snmpkey) is administratively down.";
+      }
 
    } 
    ## Check operational status
@@ -343,6 +355,7 @@
 	printf "   -n (--name)       the value should match the returned ifName\n";
 	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 "   -a (--adminwarn =i|w|c) ignore|warn|crit if the interface is administratively down (default warning)\n";
 	printf "   -V (--version)    Plugin version\n";
 	printf "   -h (--help)       usage help \n\n";
 	printf " -k or -d must be specified\n\n";



-- 
Hugo Lombard
InfoSat (Pty) Ltd

In a display of perverse brilliance, Carl the repairman mistakes a room
humidifier for a mid-range computer but manages to tie it into the network
anyway.
                -- The 5th Wave





More information about the Help mailing list