etingof / pysnmp

Python SNMP library
http://snmplabs.com/pysnmp/
BSD 2-Clause "Simplified" License
575 stars 193 forks source link

Getting No Access Error, When Variable is ScalarType and have no Index. #225

Open chetan009 opened 5 years ago

chetan009 commented 5 years ago

Reason of Error from line https://github.com/etingof/pysnmp/blob/acd16a65f89b0165b881c4f33ee5802607583c3f/pysnmp/smi/mibs/SNMPv2-SMI.py#L614

Snmpwalk is working fine. But Snmpget is failing because of this check.

etingof commented 5 years ago

You can't GET MibScalar object because it does not have any value. You can only GET MibScalarInstance ones. Those have values to report.

For example, you can't GET SNMPv2-MIB::sysDescr, but you can GET SNMPv2-MIB::sysDescr.0.

Note, however, that you can GETNEXT anything because SNMP agent just skips all non-instance objects up to the first instance object which it could report back.