Re: [pysnmp-users] PySNMP 4.3.1 strange prettyPrint() output
Brought to you by:
elie
From: Ilya E. <il...@gl...> - 2015-11-19 20:48:08
|
Hi Wei, So we are dealing with two irrelevant problems. This is related to the situation when your agent send you a value in response that does not fit MIB specification for it. With current pysnmp code it is not obvious what OID caused this, you may want to enable pysnmp debugging to figure that out (I’ll improve this exception shortly). Once you know what OID (e.g. MIB object) fails, you may fix/hack the constraints in your MIB to accommodate currently rejected value. Why this happens? I can think of two possibilities: * you are using somewhat obsolete MIB, may be later a version exists that allows that value * your agent works against MIB specification due to a bug -ilya > On 18 Nov 2015, at 23:01, Wei Wang <ww...@9r...> wrote: > > Made a bit of progress, with this manual MIB file compilation: > > mibdump.py /opt/nss/etc/snmp/mibs/cisco/AIRESPACE-WIRELESS-MIB.mib > > That created two MIB files in the .py format in ~/.pysnmp/mibs folder. > > But my code still throws exception: > > 2015-11-18 16:56:29,465 ERROR base_events.default_exception_handler:1053 Exception in callback _cbFun(<pysnmp....a2b44e90>, ('10.50.0.12', 161), '0\x82\x06[\x... \x00\x00\x00') > handle: <Handle _cbFun(<pysnmp....a2b44e90>, ('10.50.0.12', 161), '0\x82\x06[\x... \x00\x00\x00')> > Traceback (most recent call last): > File "/usr/local/lib/python2.7/dist-packages/trollius/events.py", line 136, in _run > self._callback(*self._args) > File "/usr/local/lib/python2.7/dist-packages/pysnmp/carrier/base.py", line 63, in _cbFun > self, transportDomain, transportAddress, incomingMessage > File "/usr/local/lib/python2.7/dist-packages/pysnmp/entity/engine.py", line 140, in __receiveMessageCbFun > self, transportDomain, transportAddress, wholeMsg > File "/usr/local/lib/python2.7/dist-packages/pysnmp/proto/rfc3412.py", line 453, in receiveMessage > cachedParams['cbCtx']) > File "/usr/local/lib/python2.7/dist-packages/pysnmp/entity/rfc3413/cmdgen.py", line 125, in processResponsePdu > cbFun(snmpEngine, origSendRequestHandle, None, PDU, cbCtx) > File "/usr/local/lib/python2.7/dist-packages/pysnmp/entity/rfc3413/cmdgen.py", line 349, in processResponseVarBinds > varBindTable, cbCtx): > File "/usr/local/lib/python2.7/dist-packages/pysnmp/hlapi/asyncio/cmdgen.py", line 440, in __cbFun > (errorIndication, errorStatus, errorIndex, [vbProcessor.unmakeVarBinds(snmpEngine, varBindTableRow, lookupMib) for varBindTableRow in varBindTable]) > File "/usr/local/lib/python2.7/dist-packages/pysnmp/hlapi/varbinds.py", line 37, in unmakeVarBinds > varBinds = [ObjectType(ObjectIdentity(x[0]), x[1]).resolveWithMib(mibViewController) for x in varBinds] > File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/rfc1902.py", line 728, in resolveWithMib > raise SmiError('Value %r to type %r convertion failure: %s' % (self.__args[1], self.__args[0].getMibNode().getSyntax().__class__.__name__, sys.exc_info()[1])) > SmiError: Value OctetString(hexValue='555320000000') to type 'OctetString' convertion failure: ConstraintsIntersection(ConstraintsIntersection(ConstraintsIntersection(), ValueSizeConstraint(0, 65535)), ValueSizeConstraint(3, 3)) failed at: "ValueSizeConstraint(3, 3) failed at: "US ^@^@^@"" at OctetString |