Re: [snmpsim-users] Notification Module not given snmpEngine
Brought to you by:
elie
From: Matthias S. <mat...@gm...> - 2013-11-07 11:21:52
|
Hello Ilya, yes now it is working :-) Thank you very much! Kind Regards, Matthias On Thu, Nov 7, 2013 at 10:35 AM, Ilya Etingof <il...@gl...> wrote: > Hello Matthias, > > Oh, there was another problem with notification module introduced with > multiple-engine-id support. Also > your fix was almost correct and it fixes another problem with wrong > community name sent in notifications. > > I hope those issues are finally fixed with most current notification.py: > > http://snmpsim.cvs.sourceforge.net/viewvc/snmpsim/snmpsim/?view=tar > > Please let me know what happens next? %-) > > -ilya > > On 11/07/13 11:39, Matthias Schwayer wrote: > > Hello Ilya, > > I tried the new notification.py and get the following output if I > snmpget 1 specific OID: > > Using \Users\Administrator\SNMP Simulator\Data\public.snmprec controller > selected by contextName "beb17b63dde4eb8ecf5d0c2069bfd8bb", transport ID > 1.3.6.1.6.1.1.0, source address 172.23.52.100 > SNMP EngineID 0x80004fb80510b87f08, securityModel 2, securityName > beb17b63dde4eb8ecf5d0c2069bfd8bb, securityLevel 1 > Request var-binds: 1.3.6.1.2.1.1.9.1.3.7=<>, flags: EXACT, GET > notification: sending Notification to > CommunityData(communityIndex='public', communityName=<COMMUNITY>, > mpModel=1, contextEngineId=None, contextName='', tag='1059033249', > securityName='public') with credentials UdpTransportTarget(('172.23.52.31', > 162), timeout=1, retries=5, tagList='1059033249') > Response var-binds: 1.3.6.1.2.1.1.9.1.3.7=<1> > > but the client does not show the notification. > If I change notification.py line 102 from: > authData = ntforg.CommunityData(args['community'], args['version'] == '2c' > and 1 or 0) > to: > authData = ntforg.CommunityData(args['version'] == '2c' and 1 or 0, > args['community']) > the client gets the notification but snmpsim dies with the following > output at the end: > > Using \Users\Administrator\SNMP Simulator\Data\windowspatchtest.snmprec > controller selected by contextName "beb17b63dde4eb8ecf5d0c2069bfd8bb", > transport ID 1.3.6.1.6.1.1.0, source address 172.23.52.100 > SNMP EngineID 0x80004fb80510607f08, securityModel 2, securityName > beb17b63dde4eb8ecf5d0c2069bfd8bb, securityLevel 1 > Request var-binds: 1.3.6.1.2.1.1.9.1.3.7=<>, flags: EXACT, GET > notification: sending Notification to CommunityData(communityIndex=1, > communityName=<COMMUNITY>, mpModel=1, contextEngineId=None, contextName='', > tag='-1522090753', securityName=1) with credentials > UdpTransportTarget(('172.23.52.31', 162), timeout=1, retries=5, > tagList='-1522090753') > Response var-binds: 1.3.6.1.2.1.1.9.1.3.7=<1> > Shutting down variation modules: > Variation module "notification" shutdown OK > Variation module "error" shutdown OK > Variation module "numeric" shutdown OK > Variation module "subprocess" shutdown OK > Variation module "delay" shutdown OK > Variation module "multiplex" shutdown OK > Variation module "sql" shutdown OK > Variation module "writecache" shutdown OK > Process terminated > Traceback (most recent call last):; > File "C:\Python27\Scripts\snmpsimd.py", line 1281, in <module>; > transportDispatcher.runDispatcher(); > File > "C:\Python27\lib\site-packages\pysnmp\carrier\asynsock\dispatch.py", line > 41, in runDispatcher; raise PySnmpError('poll error: %s' % > ';'.join(format_exception(*exc_info()))); > PySnmpError: poll error: Traceback (most recent call last):;; File > "C:\Python27\lib\site-packages\pysnmp\carrier\asynsock\dispatch.py", line > 37, in runDispatcher; use_poll=True, map=self.__sockMap, count=1);; > File "C:\Python27\lib\asyncore.py", line 220, in loop; > poll_fun(timeout, map);; File "C:\Python27\lib\asyncore.py", line 156, in > poll; read(obj);; File "C:\Python27\lib\asyncore.py", line 87, in read; > obj.handle_error();; File "C:\Python27\lib\asyncore.py", line 83, in > read; obj.handle_read_event();; File "C:\Python27\lib\asyncore.py", > line 449, in handle_read_event; self.handle_read();; File > "C:\Python27\lib\site-packages\pysnmp\carrier\asynsock\dgram\base.py", line > 83, in handle_read; self._cbFun(self, transportAddress, > incomingMessage);; File > "C:\Python27\lib\site-packages\pysnmp\carrier\base.py", line 56, in _cbFun; > 'No callback for "%r" found - loosing incoming > event'%(recvId,);;CarrierError: No callback for "(1, 3, 6, 1, 6, 1, 1)" > found - loosing incoming event;; > > Kind Regards, > > Matthias > > > On Wed, Nov 6, 2013 at 4:55 PM, Ilya Etingof <il...@gl...> wrote: > >> Hello Matthias, >> >> That's a bug in pysnmp. I've added a workaround for snmpsim to cope with >> it for a while: >> >> http://snmpsim.cvs.sourceforge.net/viewvc/snmpsim/snmpsim/?view=tar >> >> You can take just notification.py from the new snmpsim version. Please >> let me know if it finally helps. >> >> -ilya >> >> >> On 11/06/13 16:31, Matthias Schwayer wrote: >> >> Hello, >> >> and I forgot to mention that no notification is sent (neither inform, >> nor trap). >> >> >> On Wed, Nov 6, 2013 at 12:25 PM, Matthias Schwayer < >> mat...@gm...> wrote: >> >>> Hello Ilya, >>> >>> Sorry for the delay, but I had problems and could not test it until >>> now. >>> Now the simulator does not crash anymore, but a snmpwalk generates the >>> following output: >>> >>> iso.3.6.1.2.1.1.1.0 = STRING: "Linux squishrunner 2.6.32-5-amd64 #1 >>> SMP Sun Sep 23 10:07:46 UTC 2012 x86_64" >>> iso.3.6.1.2.1.1.2.0 = OID: iso.3.6.1.4.1.8072.3.2.10 >>> iso.3.6.1.2.1.1.3.0 = Timeticks: (1127) 0:00:11.27 >>> iso.3.6.1.2.1.1.4.0 = STRING: "Me <me...@ex...>" >>> iso.3.6.1.2.1.1.5.0 = STRING: "squishrunner" >>> iso.3.6.1.2.1.1.6.0 = STRING: "Sitting on the Dock of the Bay" >>> iso.3.6.1.2.1.1.7.0 = INTEGER: 72 >>> iso.3.6.1.2.1.1.8.0 = Timeticks: (0) 0:00:00.00 >>> iso.3.6.1.2.1.1.9.1.2.1 = OID: iso.3.6.1.6.3.10.3.1.1 >>> iso.3.6.1.2.1.1.9.1.2.2 = OID: iso.3.6.1.6.3.11.3.1.1 >>> iso.3.6.1.2.1.1.9.1.2.3 = OID: iso.3.6.1.6.3.15.2.1.1 >>> iso.3.6.1.2.1.1.9.1.2.4 = OID: iso.3.6.1.6.3.1 >>> iso.3.6.1.2.1.1.9.1.2.5 = OID: iso.3.6.1.2.1.49 >>> iso.3.6.1.2.1.1.9.1.2.6 = OID: iso.3.6.1.2.1.4 >>> iso.3.6.1.2.1.1.9.1.2.7 = OID: iso.3.6.1.2.1.50 >>> iso.3.6.1.2.1.1.9.1.2.8 = OID: iso.3.6.1.6.3.16.2.2.1 >>> iso.3.6.1.2.1.1.9.1.3.1 = STRING: "test" >>> iso.3.6.1.2.1.1.9.1.3.2 = STRING: "test" >>> iso.3.6.1.2.1.1.9.1.3.3 = STRING: "test" >>> iso.3.6.1.2.1.1.9.1.3.3 = No more variables left in this MIB View (It >>> is past the end of the MIB tree) >>> >>> Even though the *.snmprec file contains the following: >>> >>> 1.3.6.1.2.1.1.1.0|4|Linux squishrunner 2.6.32-5-amd64 #1 SMP Sun Sep >>> 23 10:07:46 UTC 2012 x86_64 >>> 1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.8072.3.2.10 >>> 1.3.6.1.2.1.1.3.0|67:numeric|wrap=1 >>> 1.3.6.1.2.1.1.4.0|4|Me <me...@ex...> >>> 1.3.6.1.2.1.1.5.0|4|squishrunner >>> 1.3.6.1.2.1.1.6.0|4|Sitting on the Dock of the Bay >>> 1.3.6.1.2.1.1.7.0|2|72 >>> 1.3.6.1.2.1.1.8.0|67|0 >>> 1.3.6.1.2.1.1.9.1.2.1|6|1.3.6.1.6.3.10.3.1.1 >>> 1.3.6.1.2.1.1.9.1.2.2|6|1.3.6.1.6.3.11.3.1.1 >>> 1.3.6.1.2.1.1.9.1.2.3|6|1.3.6.1.6.3.15.2.1.1 >>> 1.3.6.1.2.1.1.9.1.2.4|6|1.3.6.1.6.3.1 >>> 1.3.6.1.2.1.1.9.1.2.5|6|1.3.6.1.2.1.49 >>> 1.3.6.1.2.1.1.9.1.2.6|6|1.3.6.1.2.1.4 >>> 1.3.6.1.2.1.1.9.1.2.7|6|1.3.6.1.2.1.50 >>> 1.3.6.1.2.1.1.9.1.2.8|6|1.3.6.1.6.3.16.2.2.1 >>> 1.3.6.1.2.1.1.9.1.3.1|4|test >>> 1.3.6.1.2.1.1.9.1.3.2|4|test >>> 1.3.6.1.2.1.1.9.1.3.3|4|test >>> 1.3.6.1.2.1.1.9.1.3.4 >>> |4:notification|op=any,version=2c,community=public,ntftype=inform,value=1,trapoid=1.3.6.1.4.1.2021.251.1,host=172.23.52.28 >>> >>> 1.3.6.1.2.1.1.9.1.3.5|4:notification|op=any,version=2c,community=public,ntftype=inform,value=1,trapoid=1.3.6.1.4.1.2021.251.1,host=172.23.52.29 >>> >>> 1.3.6.1.2.1.1.9.1.3.6|4:notification|op=any,version=2c,community=public,ntftype=inform,value=1,trapoid=1.3.6.1.4.1.2021.251.1,host=172.23.52.30 >>> >>> 1.3.6.1.2.1.1.9.1.3.7|4:notification|op=any,version=2c,community=public,ntftype=inform,value=1,trapoid=1.3.6.1.4.1.2021.251.1,host=172.23.52.31 >>> >>> 1.3.6.1.2.1.1.9.1.3.8|4:notification|op=any,version=2c,community=public,ntftype=inform,value=1,trapoid=1.3.6.1.4.1.2021.251.1,host=172.23.52.32 >>> ... >>> ... >>> ... >>> >>> Also if I change the ntftype to trap, snmpwalk returns the first >>> notification but no more: >>> ... >>> iso.3.6.1.2.1.1.9.1.3.4 = STRING: "1" >>> iso.3.6.1.2.1.1.9.1.3.4 = No more variables left in this MIB View (It is >>> past the end of the MIB tree) >>> >>> This is the command I use to start snmpsim: >>> snmpsimd.py --agent-udpv4-endpoint=0.0.0.0:161 --logging-method=stdout >>> >>> Kind Regards, >>> >>> Matthias Schwayer >>> >>> >>> On Wed, Oct 23, 2013 at 4:08 PM, Ilya Etingof <il...@gl...> wrote: >>> >>>> Hello Matthias, >>>> >>>> Right, you can't send notifications when running in --v2c-arch mode. So >>>> please remove that option and try again. >>>> >>>> -ilya >>>> >>>> >>>> On 10/23/13 17:59, Matthias Schwayer wrote: >>>> >>>> Hello, >>>> >>>> I am using >>>> - Windows Server 2008 R2 >>>> - python 2.7.5 >>>> - snmpsim 0.2.4 >>>> - pysnmp 4.2.5 >>>> - pyasn1 0.1.7 >>>> >>>> and I am getting the following output from snmpsimd.py: >>>> >>>> 2013-10-23 15:37:29.829 snmpsimd[2892]: Using >>>> \Users\Administrator\SNMP Simulator\Data\test.snmprec controller selected >>>> by candidate test; transport ID 1.3.6.1.6.1.1.0, source address >>>> 172.24.204.16, community name "test" >>>> 2013-10-23 15:37:29.829 snmpsimd[2892]: Request var-binds: >>>> 1.3.6.1.2.1.1.9.1.3.15=<>, flags: EXACT, GET >>>> 2013-10-23 15:37:29.829 snmpsimd[2892]: data error at >>>> \Users\Administrator\SNMP Simulator\Data\test.snmprec controller for >>>> 1.3.6.1.2.1.1.9.1.3.15: variation module not given snmpEngine >>>> 2013-10-23 15:37:29.829 snmpsimd[2892]: Response var-binds: >>>> 1.3.6.1.2.1.1.9.1.3.15=<No Such Instance currently exists at this OID> >>>> >>>> The following entry is from the test.snmprec file: >>>> >>>> >>>> 1.3.6.1.2.1.1.9.1.3.15|4:notification|op=any,version=2c,community=test,ntftype=inform,value=1,trapoid=1.3.6.1.4.1.2021.251.1,host=172.23.52.39 >>>> >>>> I started snmpsimd.py with the following command: >>>> >>>> snmpsimd.py --v2c-arch --agent-udpv4-endpoint=0.0.0.0:161--logging-method=file:"\Users\Administrator\SNMP Simulator\snmpsim.log" >>>> >>>> Did I do something wrong? >>>> >>>> Thanks in advance! >>>> >>>> Kind regards, >>>> >>>> Matthias Schwayer >>>> >>>> >>>> >>> >> >> > > |