etingof / snmpsim

SNMP Simulator

Home Page:http://snmplabs.com/snmpsim/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

simpsim terminated with "runDispatcher; raise PySnmpError('poll error: %s' % ';'.join(format_exception(*exc_info())));"

mhouf opened this issue · comments

commented

Hi Illya,

Hope you're doing well,

I'm starting Huawei simulator and it's running but during the polling it always crash with following :

2020-09-03T02:01:12.41 snmpsimd: Request var-binds: 0.0=<>, flags: NEXT, GET
2020-09-03T02:01:12.41 snmpsimd: Response var-binds: 1.2.840.10006.300.43.1.2.1.1.2.5=<32768>
2020-09-03T02:01:12.43 snmpsimd: Shutting down variation modules:
2020-09-03T02:01:12.43 snmpsimd: Variation module "notification" shutdown OK
2020-09-03T02:01:12.45 snmpsimd: Variation module "sql" shutdown OK
2020-09-03T02:01:12.45 snmpsimd: Variation module "redis" shutdown OK
2020-09-03T02:01:12.45 snmpsimd: Variation module "numeric" shutdown OK
2020-09-03T02:01:12.45 snmpsimd: Variation module "subprocess" shutdown OK
2020-09-03T02:01:12.45 snmpsimd: Variation module "delay" shutdown OK
2020-09-03T02:01:12.45 snmpsimd: Variation module "multiplex" shutdown OK
2020-09-03T02:01:12.45 snmpsimd: Variation module "error" shutdown OK
2020-09-03T02:01:12.45 snmpsimd: Variation module "writecache" shutdown OK
2020-09-03T02:01:12.45 snmpsimd: Process terminated
2020-09-03T02:01:12.45 snmpsimd: ERROR Traceback (most recent call last):;
*2020-09-03T02:01:12.45 snmpsimd: ERROR File "/usr/lib/python2.7/site-packages/snmpsim-0.4.7-py2.7.egg/EGG-INFO/scripts/snmpsimd.py", line 1466, in ; transportDispatcher.runDispatcher();
2020-09-03T02:01:12.45 snmpsimd: ERROR File "/usr/lib/python2.7/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 50, in runDispatcher; raise PySnmpError('poll error: %s' % ';'.join(format_exception(exc_info())));
2020-09-03T02:01:12.45 snmpsimd: ERROR PySnmpError: poll error: Traceback (most recent call last):;; File "/usr/lib/python2.7/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 46, in runDispatcher; use_poll=True, map=self.__sockMap, count=1);; File "/usr/lib64/python2.7/asyncore.py", line 220, in loop; poll_fun(timeout, map);; File "/usr/lib64/python2.7/asyncore.py", line 201, in poll2; readwrite(obj, flags);; File "/usr/lib64/python2.7/asyncore.py", line 123, in readwrite; obj.handle_error();; File "/usr/lib64/python2.7/asyncore.py", line 108, in readwrite; obj.handle_read_event();; File "/usr/lib64/python2.7/asyncore.py", line 449, in handle_read_event; self.handle_read();; File "/usr/lib/python2.7/site-packages/pysnmp/carrier/asyncore/dgram/base.py", line 163, in handle_read; self._cbFun(self, transportAddress, incomingMessage);; File "/usr/lib/python2.7/site-packages/pysnmp/carrier/base.py", line 70, in _cbFun; self, transportDomain, transportAddress, incomingMessage;; File "/usr/lib/python2.7/site-packages/snmpsim-0.4.7-py2.7.egg/EGG-INFO/scripts/snmpsimd.py", line 958, in commandResponderCbFun; wholeMsg, asn1Spec=pMod.Message(),;; File "/usr/lib/python2.7/site-packages/pyasn1/codec/ber/decoder.py", line 1293, in call; **options;; File "/usr/lib/python2.7/site-packages/pyasn1/codec/ber/decoder.py", line 537, in valueDecoder; component, head = decodeFun(head, componentType, **options);; File "/usr/lib/python2.7/site-packages/pyasn1/codec/ber/decoder.py", line 1293, in call; **options;; File "/usr/lib/python2.7/site-packages/pyasn1/codec/ber/decoder.py", line 811, in valueDecoder; tagSet, length, state, **options;; File "/usr/lib/python2.7/site-packages/pyasn1/codec/ber/decoder.py", line 1293, in call; **options;; File "/usr/lib/python2.7/site-packages/pyasn1/codec/ber/decoder.py", line 537, in valueDecoder; component, head = decodeFun(head, componentType, **options);; File "/usr/lib/python2.7/site-packages/pyasn1/codec/ber/decoder.py", line 1293, in call; **options;; File "/usr/lib/python2.7/site-packages/pyasn1/codec/ber/decoder.py", line 604, in valueDecoder; component, head = decodeFun(head, componentType, **options);; File "/usr/lib/python2.7/site-packages/pyasn1/codec/ber/decoder.py", line 1293, in call; **options;; File "/usr/lib/python2.7/site-packages/pyasn1/codec/ber/decoder.py", line 537, in valueDecoder; component, head = decodeFun(head, componentType, **options);; File "/usr/lib/python2.7/site-packages/pyasn1/codec/ber/decoder.py", line 1318, in call; '%s not in asn1Spec: %r' % (tagSet, asn1Spec);;PyAsn1Error: <TagSet object at 0x1bd0250 tags 64:0:7> not in asn1Spec: <_BindValue schema object at 0x1225990 componentType=<NamedTypes object at 0x1225050 types <NamedType object at 0x1223ed0 type value=<ObjectSyntax schema object at 0x1223e10 componentType=<NamedTypes object at 0x12234d0 types <NamedType object at 0x1223410 type simple=<SimpleSyntax schema object at 0x1223390 componentType=<NamedTypes object at 0x1221110 types <NamedType object at 0x121bf90 type integer-value=<Integer schema object at 0x121bed0 subtypeSpec <ConstraintsIntersection object at 0x1211f10 consts <ValueRangeConstraint object at 0x1211dd0 consts -2147483648, 2147483647>> tagSet <TagSet object at 0x113e790 tags 0:0:2>>>, <NamedType object at 0x1221050 type string-value=<OctetString schema object at 0x121bfd0 subtypeSpec <ConstraintsIntersection object at 0x121b090 consts <ValueSizeConstraint object at 0x1211f90 consts 0, 65535>> tagSet <TagSet object at 0x113ee90 tags 0:0:4> encoding iso-8859-1>>, <NamedType object at 0x12210d0 type objectID-value=<ObjectIdentifier schema object at 0x1221090 tagSet <TagSet object at 0x11443d0 tags 0:0:6>>>> subtypeSpec=<ConstraintsIntersection object at 0x114b6d0> sizeSpec=<ConstraintsIntersection object at 0x114b750 consts <ValueSizeConstraint object at 0x114b710 consts 1, 1>> tagSet=<TagSet object at 0x114b510 untagged>>>, <NamedType object at 0x1223490 type application-wide=<ApplicationSyntax schema object at 0x1223450 componentType=<NamedTypes object at 0x1221950 types <NamedType object at 0x1221690 type ipAddress-value=<IpAddress schema object at 0x1221650 subtypeSpec <ConstraintsIntersection object at 0x121b1d0 consts <ValueSizeConstraint object at 0x1211f90 consts 0, 65535>, <ValueSizeConstraint object at 0x121b110 consts 4, 4>> tagSet <TagSet object at 0x121b250 tags 64:0:0> encoding iso-8859-1>>, <NamedType object at 0x1221710 type counter-value=<Counter32 schema object at 0x12216d0 subtypeSpec <ConstraintsIntersection object at 0x121b390 consts <ValueRangeConstraint object at 0x121b310 consts 0, 4294967295>> tagSet <TagSet object at 0x121b410 tags 64:0:1>>>, <NamedType object at 0x1221790 type timeticks-value=<TimeTicks schema object at 0x1221750 subtypeSpec <ConstraintsIntersection object at 0x121b9d0 consts <ValueRangeConstraint object at 0x121b910 consts 0, 4294967295>> tagSet <TagSet object at 0x121ba10 tags 64:0:3>>>, <NamedType object at 0x1221810 type arbitrary-value=<Opaque schema object at 0x12217d0 tagSet <TagSet object at 0x121bc10 tags 64:0:4> encoding iso-8859-1>>, <NamedType object at 0x1221890 type big-counter-value=<Counter64 schema object at 0x1221850 subtypeSpec <ConstraintsIntersection object at 0x121bcd0 consts <ValueRangeConstraint object at 0x121bb10 consts 0, 18446744073709551615L>> tagSet <TagSet object at 0x121bd50 tags 64:0:6>>>, <NamedType object at 0x1221910 type gauge32-value=<Gauge32 schema object at 0x12218d0 subtypeSpec <ConstraintsIntersection object at 0x121b5d0 consts <ValueRangeConstraint object at 0x121b510 consts 0, 4294967295>> tagSet <TagSet object at 0x121b610 tags 64:0:2>>>> subtypeSpec=<ConstraintsIntersection object at 0x114b6d0> sizeSpec=<ConstraintsIntersection object at 0x114b750 consts <ValueSizeConstraint object at 0x114b710 consts 1, 1>> tagSet=<TagSet object at 0x114b510 untagged>>>> subtypeSpec=<ConstraintsIntersection object at 0x114b6d0> sizeSpec=<ConstraintsIntersection object at 0x114b750 consts <ValueSizeConstraint object at 0x114b710 consts 1, 1>> tagSet=<TagSet object at 0x114b510 untagged>>>, <NamedType object at 0x1223f10 type unSpecified=<Null value object at 0x1223910 subtypeSpec <ConstraintsIntersection object at 0x11442d0 consts <SingleValueConstraint object at 0x11441d0 consts ''>> tagSet <TagSet object at 0x11440d0 tags 0:0:5> encoding iso-8859-1 payload []>>, <NamedType object at 0x1223f50 type noSuchObject=<NoSuchObject value object at 0x1223950 subtypeSpec <ConstraintsIntersection object at 0x11442d0 consts <SingleValueConstraint object at 0x11441d0 consts ''>> tagSet <TagSet object at 0x1223a10 tags 128:0:0> encoding iso-8859-1 payload [No Such Object c...ists at this OID]>>, <NamedType object at 0x1223f90 type noSuchInstance=<NoSuchInstance value object at 0x1223a90 subtypeSpec <ConstraintsIntersection object at 0x11442d0 consts <SingleValueConstraint object at 0x11441d0 consts ''>> tagSet <TagSet object at 0x1223b90 tags 128:0:1> encoding iso-8859-1 payload [No Such Instance...ists at this OID]>>, <NamedType object at 0x1223fd0 type endOfMibView=<EndOfMibView value object at 0x1223c50 subtypeSpec <ConstraintsIntersection object at 0x11442d0 consts <SingleValueConstraint object at 0x11441d0 consts ''>> tagSet <TagSet object at 0x1223d50 tags 128:0:2> encoding iso-8859-1 payload [No more variable...in this MIB View]>>> subtypeSpec=<ConstraintsIntersection object at 0x114b6d0> sizeSpec=<ConstraintsIntersection object at 0x114b750 consts <ValueSizeConstraint object at 0x114b710 consts 1, 1>> tagSet=<TagSet object at 0x114b510 untagged>>;;

The device has a normal value for the above polled OID :
1.2.840.10006.300.43.1.2.1.1.2.5, Integer , 32768

[root@~]# python
Python 3.6.6 (default, Sep 30 2018, 09:36:27)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.

exit
Use exit() or Ctrl-D (i.e. EOF) to exit

[root@~]# snmpsimd.py --version
SNMP Simulator version 0.4.7, written by Ilya Etingof etingof@gmail.com
Using foundation libraries: pysnmp 4.4.4, pyasn1 0.4.2.
Python interpreter: 2.7.5 (default, Aug 2 2016, 04:20:16)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]

Can you please help me to identify the root cause of such crash ?

Thanks,

commented

can you share the mib file?

Thanks,

commented

Hi KexZh,

I'm attaching sapwalk of the device. I suspect an issue in it due to small size and maybe missing standard OIDs
Huawei_NQA_2011.2.224.315.zip

Thanks,
Mo

commented

Hi @mhouf ,
can you try with the files which generated by snmpsim-record-commands or netsnmp?

snmpsim-record-commands --agent-udpv4-endpoint=demo.snmplabs.com
--output-file=./data/public.snmprec

Thanks,

commented

Hello KexZh,

I'm not sure if I understand what you mean, I'm using the following command to start the simulator 👍

/usr/bin/python /usr/bin/snmpsimd.py --agent-udpv4-endpoint=x.x.x.x:161 --data-dir= --v2c-arch --process-user=xxxx --process-group=xxxx --daemonize --pid-file=/opt/SNMP_repo/Logs/snmpsimd-Huawei_315_2.pid --logging-method=file:/opt/SNMP_repo/Logs/Huawei_315_2.log

Do you mean execute data.py on the sapwalk to generate .rec file?

Please explain further.

BR,
Mo

commented

Hello KexZh,

I'm not sure if I understand what you mean, I'm using the following command to start the simulator 👍

/usr/bin/python /usr/bin/snmpsimd.py --agent-udpv4-endpoint=x.x.x.x:161 --data-dir= --v2c-arch --process-user=xxxx --process-group=xxxx --daemonize --pid-file=/opt/SNMP_repo/Logs/snmpsimd-Huawei_315_2.pid --logging-method=file:/opt/SNMP_repo/Logs/Huawei_315_2.log

Do you mean execute data.py on the sapwalk to generate .rec file?

Please explain further.

BR,
Mo

How you collect the output you shared before?
snmpsim-record-commands, netsnmp or a thirdparty tool?

commented

Hello KexZh,

The output of the simulation is the one mentioned in snmpsim command "/opt/SNMP_repo/Logs/Huawei_315_2.log"

The simulation start and have PID but during the start of the polling from 3rd party software, it crashes, and the simulation log mention this -:

2020-09-03T02:01:12.41 snmpsimd: Request var-binds: 0.0=<>, flags: NEXT, GET
2020-09-03T02:01:12.41 snmpsimd: Response var-binds: 1.2.840.10006.300.43.1.2.1.1.2.5=<32768>
2020-09-03T02:01:12.43 snmpsimd: Shutting down variation modules:

I assume there is something wrong in sapwalk causing such unexpected termination.

BR,
Mo

commented

Hello KexZh,

The output of the simulation is the one mentioned in snmpsim command "/opt/SNMP_repo/Logs/Huawei_315_2.log"

The simulation start and have PID but during the start of the polling from 3rd party software, it crashes, and the simulation log mention this -:

2020-09-03T02:01:12.41 snmpsimd: Request var-binds: 0.0=<>, flags: NEXT, GET
2020-09-03T02:01:12.41 snmpsimd: Response var-binds: 1.2.840.10006.300.43.1.2.1.1.2.5=<32768>
2020-09-03T02:01:12.43 snmpsimd: Shutting down variation modules:

I assume there is something wrong in sapwalk causing such unexpected termination.

BR,
Mo

Yes, you're right.
Depends on this I suggest you to polling the SNMPwalk data with

snmpsim-record-commands --agent-udpv4-endpoint=demo.snmplabs.com
--output-file=./data/public.snmprec 

or NETSNMP instead of sapwalk?

commented

Hi KexZh,

Thanks for your input, issue fixed after converting exiting sapwalk to snmp.rec using data.py and using the below options -:
--ignore-broken-records --deduplicate-records

Thank you,
Mo