check_ifoperstatus option -n ifName not working as expected

James Affeld jamesaffeld at yahoo.com
Fri Nov 3 22:40:11 CET 2006


This looks like a fix, thanks!

I added a '\n' to line 217, as well.

BEFORE
      $answer = "Interface $name (index $snmpkey) is up.";

AFTER
      $answer = "Interface $name (index $snmpkey) is up.\n";

Gives a clean new command line for me.  Probably doesn't matter except when running the plugin manually.  
------------------------------

Message: 6
Date: Thu, 2 Nov 2006 16:47:12 -0600
From: "Marc Powell" <marc at ena.com>
Subject: Re: [Nagios-users] check_ifoperstatus option -n ifName not
    working    asexpected
To: <nagios-users at lists.sourceforge.net>
Message-ID: <A7B0A9F02975A74A845FE85D0B95B8FA05960F83 at misex01.ena.com>
Content-Type: text/plain;    charset="US-ASCII"



> -----Original Message-----
> From: nagios-users-bounces at lists.sourceforge.net [mailto:nagios-users-
> bounces at lists.sourceforge.net] On Behalf Of James Affeld
> Sent: Thursday, November 02, 2006 4:22 PM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] check_ifoperstatus option -n ifName not
working
> asexpected
> 
> I'm running check_ifoperstatus to check the condition of interfaces on
a
> Cisco 6009 running CatOS software.
> I'm specifing the SNMP IfIndex value as recommended.   But since the
> IfIndex value can change as the switch is rebooted, I'm running -I
(agent
> supports IFMib ifXTable) and -n (IfName) to verify that I have the
correct
> interface.  When I use -n, I must supply an ifName, but it doesn't
matter
> what ifName I supply.  It comes back with the current ifName for that
> IfIndex and doesn't error out if that ifName doesn't match what I
supply.
> Why require a parameter for -n if the parameter doesn't affect the
return
> condition?
> 
> root at silmec2:/usr/local/nagios/libexec# ./check_ifoperstatus -H
10.139.7.1
> -C REDACTED -k 351 -I -n 4/44
> CRITICAL: Interface 9/6 -  (index 351) is down.
> 
> root at silmec2:/usr/local/nagios/libexec# ./check_ifoperstatus -H
10.139.7.1
> -C REDACTED -k 347 -I -n 4/44
> OK: Interface 9/2 -  (index 347) is up.
> 
> Am I missing something, or is check_ifoperstatus  ?

Looks like check_ifoperstatus. Testing here I see the same results. It
looks like the $name references on lines 155 and 157 should be $ifName.
--

Before --

   ## Check to see if ifName match is requested and it matches - exit if
no match
   ## not the interface we want to monitor
   if ( defined $name && not ($response->{$snmpIfName} eq $name) ) {
      $state = 'UNKNOWN';
      $answer = "Interface name ($name) doesn't match snmp value
($response->{$snmpIfName}) (index $snmpkey)";
      print ("$state: $answer");
      exit $ERRORS{$state};
   }

$ ./check_ifoperstatus -H REDACTED -C REDACTED -k 1 -I -n 4/44
OK: Interface Gi1/1 - @@IN peer01 (index 1) is up.

After --

   ## Check to see if ifName match is requested and it matches - exit if
no match
   ## not the interface we want to monitor
   if ( defined $ifName && not ($response->{$snmpIfName} eq $ifName) ) {
      $state = 'UNKNOWN';
      $answer = "Interface name ($ifName) doesn't match snmp value
($response->{$snmpIfName}) (index $snmpkey)";
      print ("$state: $answer");
      exit $ERRORS{$state};
   }

$ ./check_ifoperstatus -H REDACTED -C REDACTED -k 1 -I -n 4/44
UNKNOWN: Interface name (4/44) doesn't match snmp value (Gi1/1) (index
1)

$ ./check_ifoperstatus -H REDACTED -C REDACTED -k 1 -I -n Gi1/1
OK: Interface Gi1/1 - @@IN peer01 (index 1) is up.

I'm not sure if that is all the code changes necessary but it does
produce the expected behavior.

--
Marc









-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list