-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong value used for error handling in snmp module #81
Comments
Turns out making this changed caused some problems, ref #128 Sometimes the Reopenin this issue so maybe we can find a better way to do this without breaking things. maybe theres a way to get both the OID and the error message, and utilize this error message for more exact logging? Or maybe we just scrap this and continue as before since it works. pysnmp is inconsistent at best anyways.. |
I'm re-uploading my comment from #128 here: I don't think this is pysnmp being weird. This is probably just a result of how SNMP v2c works. I think I recently made some similar comments on how errors were handled / not handled in NAV during the recent SNMP v3 additions there. SNMP v2c introduces a concept of "exceptions" being raised by an SNMP agent, and these "exceptions" are flagged as specific return value types in the varbinds of a response PDU (SNMP v1 only had the error-flag and error-index way of reporting errors back to the querying entity). In practice, this means that if you send an SNMP request with multiple varbinds in it (i.e. you're querying multiple objects in the same request), and the responding agent encountered an error with one of those varbinds, it can still return a response that contains a value for the ok varbinds and an error for the problematic varbinds. I don't think I have the specifics on what actually failed in your case... |
I would add, however, that I would still expect the response varbind to include a reference to the failing OID from the request, where the value would be some SNMP exception type. |
Currently the
query
used for a snmp command is put directly into_handle_errors
like so:According to the
getCmd
documentation, theerrorIndex
specifically refers to thevarBinds
return value:It seems to be working to use
query
, asquery
andvar_binds
probably contain the exact same things most of the time.But to avoid problems that may show up,
var_binds
should be used in_handle_errors
instead ofquery
The text was updated successfully, but these errors were encountered: