Closed iargue closed 8 years ago
If I'm using OID why do I need an MIB?
That's because you are passing a value (2) along with the OID. The value is untyped (to SNMP). To send a well formed packet, pysnmp needs to figure out SNMP type of the value you are sending. The only way for pysnmp to handle this is to look up the MIB. But pysnmp can't [yet] figure what MIB it should load to get hold of MIB object identified by that OID (e.g. OID->MIB mapping is not implemented).
To fix that you simply need to give it SNMP type for your value:
ObjectType(ObjectIdentity('1.3.6.1.4.1.9.9.96.1.1.1.1.2.100'), Integer32(2))
Why does it not have this MIB anyways if its on http://mibs.snmplabs.com/asn1/CISCO-CONFIG-COPY-MIB, and how do I fix?
We need someone to implement OID->MIB map so that pysnmp could download and use proper MIB in some cases. I'd happily merge such kind of PR. ;-)
Help ful
Best to copy mib_file_name.py to "\venv\Lib\site-packages\pysnmp\smi\mibs"
I am attempting to use an SNMP set command to copy config files on a Cisco device.
I am attempting to use the OID for Cisco Config Copy MIB.
The first OID is 1.3.6.1.4.1.9.9.96.1.1.1.1.2.x.
I simply cannot get it to work.
Traceback (most recent call last): File "C:\Project Files\snmptest.py", line 11, in
lookupMib=False):
File "C:\Python27\lib\site-packages\pysnmp\hlapi\asyncore\sync\cmdgen.py", line 210, in setCmd
lookupMib=options.get('lookupMib', True)))
File "C:\Python27\lib\site-packages\pysnmp\hlapi\asyncore\cmdgen.py", line 235, in setCmd
contextData.contextName, vbProcessor.makeVarBinds(snmpEngine, varBinds),
File "C:\Python27\lib\site-packages\pysnmp\hlapi\varbinds.py", line 36, in makeVarBinds
varBinds.append(varBind.resolveWithMib(mibViewController))
File "C:\Python27\lib\site-packages\pysnmp\smi\rfc1902.py", line 845, in resolveWithMib
raise SmiError('MIB object %r is not OBJECT-TYPE (MIB not loaded?)' % (self.args[0],))
pysnmp.smi.error.SmiError: MIB object ObjectIdentity('1.3.6.1.4.1.9.9.96.1.1.1.1.2.100') is not OBJECT-TYPE (MIB not loa
ded?)
If I'm using OID why do I need an MIB? Why does it not have this MIB anyways if its on http://mibs.snmplabs.com/asn1/CISCO-CONFIG-COPY-MIB, and how do I fix?