[Nagiosplug-devel] RE: nagiosplug- check_snmp

Karl DeBisschop karl at debisschop.net
Fri Nov 15 04:04:01 CET 2002


On Thu, 2002-11-14 at 23:48, Subhendu Ghosh wrote:
> On 14 Nov 2002, Karl DeBisschop wrote:
> 
> > On Thu, 2002-11-14 at 16:13, Subhendu Ghosh wrote:
> > > Yes - warning state when it shouldn't be. - dropping the " }else{ "
> > > clause back in seems to fix it.
> > > 
> > > check_snmp - should be supporting both 4.x and 5.x  - most of my testing 
> > > is 4.x 
> > > 
> > > I'll pop the "else" clause back in tonight
> > 
> > I'm about to drop in a patch that includes this, plud better handling of
> > units for multiple checks.
> > 
> > Just give my patch a once over,
> > 
> > I'm changing line 310 to:
> > 
> > 		} else if (eval_method[i] & WARN_PRESENT) {
> > 
> > But you refered to line 326, so I'm not 100% sure we're talking about
> > the exact same solution, though the problem seems the same.
> > 
> > 
> 
> line 310 - (above) I don't see anything different from the current CVS.
> Essentially I have a question about whether the whole if/else if statement 
> covering lines 308-312 make any sense since the CRIT_PRESENT/WARN_PRESENT 
> flags are not (and will not be set until after the output has been 
> evaluated.  The eval does start till line 314.

Well, it sort of does. If an oid is present, the while loop runs for
each OID that is returned. So just reaching that line correctly triggers
(WARN|CRIT)_PRESENT, at least as far as my read goes. Probably all the
other tests are superfluous, at least on CRIT_PRESENT -- but you need to
run them so the output line is fully informative.

However, there is a different problem. When you submit 2 oids, and one
is not present in the returns the one that is there. 

It does return 2 to the shell, so the error is indicated, but we miss it
somewhere. Plus, the diagnosis of which oid is missing need standard
error, which we don't parse. And taht parsing is not straightforward
because the oid is not always returned in the same format as it was
sent.

[kdebisschop at toaster nagiosplug]$ snmpget -c staff localhost
.1.3.6.1.4.1.2021.9.1.9.111 .1.3.6.1.4.1.2021.9.1.9.1
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: UCD-SNMP-MIB::dskPercent.1

Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: UCD-SNMP-MIB::dskPercent.111

In other words, the code comments are dead on to mark it experimental.
We should also make sure it is so marked if it appears in the docs.

> Also the flags should get set in the check_num() routine when iresult is 
> modified - but currently don't - so the flags are superflous at the 
> moment.

I'm not following you here. Can you explain this to me again?

> My ref to line 326 was in v1.8 - current CVS line 358-360 - should be 
> concatanated with an "else" clause instead of being separate if 
> statements.
-- 
Karl DeBisschop <karl at debisschop.net>





More information about the Devel mailing list