[Nagiosplug-devel] RE: nagiosplug- check_snmp

Subhendu Ghosh sghosh at sghosh.org
Fri Nov 15 09:40:05 CET 2002


On 15 Nov 2002, Karl DeBisschop wrote:

> > 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.
> 

if (WARN|CRIT)_PRESENT  - then yes - should possibly skip the rest of the 
checks, but in this case we are checking for the flag to be present in the 
for the iteration of the OID in the while loop - not the previous loops.

That could be achieved by looking at iresult before setting it to 
STATE_DEPENDENT.


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

-yes  this would force the rewrite. :(

> 
> 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

this raises the quistion whether the plugin should put in an -O flag to 
the command so we know the output format, and could possibly using 
snmptranslate to map the input to the error OID

> 
> 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.

(WARN|CRIT)_PRESENT flags are never set anywhere - they are just checked -
hence my comment about the superflous if/else statement above.  check_num
should set these flags in addition to setting the result.


> 
> 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.
> 

the basic login checking the output in the while loop

if ( WARN|CRIT comparion flags set)

else if ( STRING comparision flag set)

else if (REGEX comparison flag set)

else ( no comparision flags set)


currently the trailing else clause is not present (but the contents of the 
clause are present as a separate statement over-riding the logic)


I'll put the changes into CVS.

-sg


-- 







More information about the Devel mailing list