The result of a GET query on a proprietary MIB was: (None, None, None, []). What is the meaning of this result ?
This is the python script:
>>>g= getCmd(SnmpEngine(),
... CommunityData('admin'),
... UdpTransportTarget(('10.0.1.134', 161)),
... '1.3.6.1.4.1.4515.1.8.1.1.1.8.1295360.1295360'
)
>>>next(g)
(None, None, None, [])
I have added the Debug lines and got the following result:
>>> from pysnmp.hlapi import *
>>> from pysnmp.debug import setLogger, Debug
>>>
>>> setLogger(Debug('msgproc', 'secmod'))
2017-02-21 10:27:44,322 pysnmp: running pysnmp version 4.3.2
2017-02-21 10:27:44,322 pysnmp: debug category 'msgproc' enabled
2017-02-21 10:27:44,322 pysnmp: debug category 'secmod' enabled
>>>
>>>
>>> g= getCmd(SnmpEngine(),
... CommunityData('admin'),
... UdpTransportTarget(('10.0.1.134', 161)),
... '1.3.6.1.4.1.4515.1.8.1.1.1.8.1295360.1295360'
... )
>>> next(g)
(None, None, None, [])
I have even tried to add the ContextData() that was missing and got the following result:
>>> from pysnmp.hlapi import *
>>> from pysnmp.debug import setLogger, Debug
>>> setLogger(Debug('msgproc', 'secmod'))
2017-02-21 10:29:41,640 pysnmp: running pysnmp version 4.3.2
2017-02-21 10:29:41,640 pysnmp: running pysnmp version 4.3.2
2017-02-21 10:29:41,640 pysnmp: debug category 'msgproc' enabled
2017-02-21 10:29:41,640 pysnmp: debug category 'msgproc' enabled
2017-02-21 10:29:41,640 pysnmp: debug category 'secmod' enabled
2017-02-21 10:29:41,640 pysnmp: debug category 'secmod' enabled
>>> g= getCmd(SnmpEngine(),
... CommunityData('admin'),
... UdpTransportTarget(('10.0.1.134', 161)),
... ContextData(),
... '1.3.6.1.4.1.4515.1.8.1.1.1.8.1295360.1295360'
... )
>>> next(g)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python35\lib\site-packages\pysnmp-4.3.2-py3.5.egg\pysnmp\hlapi\asyncore\sync\cmdgen.py", line 107, in getCmd
File "C:\Program Files\Python35\lib\site-packages\pysnmp-4.3.2-py3.5.egg\pysnmp\hlapi\asyncore\cmdgen.py", line 127, in getCmd
File "C:\Program Files\Python35\lib\site-packages\pysnmp-4.3.2-py3.5.egg\pysnmp\hlapi\varbinds.py", line 36, in makeVarBinds
File "C:\Program Files\Python35\lib\site-packages\pysnmp-4.3.2-py3.5.egg\pysnmp\smi\rfc1902.py", line 845, in resolveWithMib
pysnmp.smi.error.SmiError: MIB object ObjectIdentity('1') is not OBJECT-TYPE (MIB not loaded?)
>>>
Can you see what I am doing wrong ? Could it be that the fact that I have used other MIB files in order to convert my proprietary MIB into .py format have changed my MIB somehow ? Don't you think that I should better do the mibdump.py conversion over the whole MIB Tree (without using the http sources)?
TL;RD; You are missing the contextData
parameter:
errorIndication, errorStatus, errorIndex, varBinds = next(
getCmd(SnmpEngine(),
CommunityData('public'),
UdpTransportTarget(('demo.snmplabs.com', 161)),
ContextData(),
ObjectType(ObjectIdentity('1.3.6.1.2.1.1.1.0')),
ObjectType(ObjectIdentity('1.3.6.1.2.1.1.6.0')))
)
as you can see in the documentation.
The yielded tuple unpacks into errorIndication
, errorStatus
, errorIndex
, varBinds
components:
errorIndication
manifests hard error coming from either local or remote SNMP engineerrorStatus
indicates one of the pre-defined SNMP error codes coming from remote SNMP enginevarBinds
is a sequence of OID-value pairs as sent by remote SNMP engine in response to your requestThe (None, None, None, [])
return looks like remote SNMP engine does not put any OID-value pairs into response PDU. To figure that out I'd turn on pysnmp debugging:
from pysnmp.debug import setLogger, Debug
setLogger(Debug('msgproc', 'secmod'))
to see what is going out from you and what is coming in response from remote end.
My guess is that since you are misplacing the OID parameter, you're effectively sending empty OID-values list so that remote end responds with nothing.