Open eLvErDe opened 5 years ago
This is curious... Let's add this at the beginning of the script and give it another run:
from pysnmp import debug
debug.setLogger(debug.Debug('msgproc', 'secmod'))
Hi,
Seems to be somehow related to ContextData(), I added this to the call and now I get a value. So after that I ported this code snippet back to my class and modified it step by step and finally I'm able to extract the required value but this is very strange because I had a ContextData instance passed to getCmd ?!?!
Ah, indeed, that's the missing ContextData
parameter!
Somehow your only OID got consumed as ContextData
(which is ignored if SNMPv1/v2c is in use). Therefore no OIDs remain in the getCmd
call. Thus pysnmp returns empty response.
Okay well, that's a bit weird. Are you sure it's a normal behavior ? I mean, it's really hard to understand what's going on...
Okay well, that's a bit weird. Are you sure it's a normal behavior ? I mean, it's really hard to understand what's going on...
Absolutely, I will push a PR to assert ContextData
parameter type.
The result of
None
None
None
[]
was caused by a varBinds
check,
https://github.com/etingof/pysnmp/blob/v4.4.12/pysnmp/hlapi/asyncore/sync/cmdgen.py#L119
While it is easy to say "to assert ContextData
parameter type", the assertion has to be added to multiple locations, which is less ideal. Besides, async operations are verified differently.
Thus, probably leave it as it is, because most people copy the official examples to get started and they shouldn't experience such a missing argument.
Hello,
I'm sorry, I'm probably dump but I *never" managed to get pySNMP working.
I started making a class to implement a protocol SNMP-based but getSnmp *always" says there's no error but returns and empty payload.
So I ended up trying something really minimal, based on an example, and it still does not work:
Returns
While it is working perfeclty fine using command line:
Thanks in advance for your help,
Adam.