pysnmp-users Mailing List for SNMP library for Python (Page 11)
Brought to you by:
elie
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(2) |
Sep
(3) |
Oct
(2) |
Nov
(4) |
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
(3) |
Mar
(16) |
Apr
(3) |
May
(6) |
Jun
|
Jul
(7) |
Aug
(12) |
Sep
(4) |
Oct
(2) |
Nov
(11) |
Dec
(6) |
2004 |
Jan
(1) |
Feb
(41) |
Mar
(4) |
Apr
(1) |
May
(6) |
Jun
|
Jul
(8) |
Aug
(5) |
Sep
(8) |
Oct
(10) |
Nov
(3) |
Dec
(1) |
2005 |
Jan
|
Feb
(4) |
Mar
(8) |
Apr
(4) |
May
(10) |
Jun
(5) |
Jul
(10) |
Aug
(6) |
Sep
(6) |
Oct
(39) |
Nov
(20) |
Dec
(21) |
2006 |
Jan
(14) |
Feb
(6) |
Mar
(15) |
Apr
|
May
(5) |
Jun
(16) |
Jul
(16) |
Aug
(18) |
Sep
(35) |
Oct
(12) |
Nov
(3) |
Dec
(3) |
2007 |
Jan
(12) |
Feb
(19) |
Mar
(27) |
Apr
(14) |
May
(32) |
Jun
|
Jul
(35) |
Aug
(11) |
Sep
(11) |
Oct
(6) |
Nov
(13) |
Dec
(4) |
2008 |
Jan
(7) |
Feb
(4) |
Mar
(2) |
Apr
(3) |
May
(3) |
Jun
(5) |
Jul
(5) |
Aug
(1) |
Sep
(2) |
Oct
(3) |
Nov
(19) |
Dec
(7) |
2009 |
Jan
(2) |
Feb
(2) |
Mar
(12) |
Apr
(16) |
May
(16) |
Jun
(23) |
Jul
(7) |
Aug
(2) |
Sep
(17) |
Oct
(20) |
Nov
(20) |
Dec
(5) |
2010 |
Jan
(11) |
Feb
(17) |
Mar
(20) |
Apr
(7) |
May
(6) |
Jun
(14) |
Jul
(5) |
Aug
(10) |
Sep
(23) |
Oct
(16) |
Nov
(32) |
Dec
(21) |
2011 |
Jan
(6) |
Feb
(11) |
Mar
(3) |
Apr
(1) |
May
(4) |
Jun
(1) |
Jul
(4) |
Aug
(8) |
Sep
(20) |
Oct
(9) |
Nov
(29) |
Dec
(25) |
2012 |
Jan
(2) |
Feb
(5) |
Mar
(2) |
Apr
(22) |
May
(21) |
Jun
(7) |
Jul
(6) |
Aug
(2) |
Sep
(12) |
Oct
(20) |
Nov
(17) |
Dec
(17) |
2013 |
Jan
(4) |
Feb
(4) |
Mar
(8) |
Apr
(8) |
May
(10) |
Jun
(2) |
Jul
(23) |
Aug
(12) |
Sep
(14) |
Oct
(12) |
Nov
(4) |
Dec
(18) |
2014 |
Jan
(2) |
Feb
(7) |
Mar
(3) |
Apr
(8) |
May
(7) |
Jun
(1) |
Jul
(5) |
Aug
(2) |
Sep
(8) |
Oct
|
Nov
(2) |
Dec
(1) |
2015 |
Jan
(3) |
Feb
(15) |
Mar
(14) |
Apr
(4) |
May
(6) |
Jun
(3) |
Jul
(1) |
Aug
(6) |
Sep
(5) |
Oct
(21) |
Nov
(43) |
Dec
(10) |
2016 |
Jan
|
Feb
(2) |
Mar
(6) |
Apr
(4) |
May
(6) |
Jun
(2) |
Jul
(6) |
Aug
(5) |
Sep
(4) |
Oct
|
Nov
(3) |
Dec
(11) |
2017 |
Jan
(1) |
Feb
(8) |
Mar
|
Apr
(7) |
May
|
Jun
|
Jul
(5) |
Aug
|
Sep
(9) |
Oct
(8) |
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
From: Ilya E. <il...@gl...> - 2014-05-26 06:11:17
|
Hi Johnny, Gauge/Gauge32 types are universally supported so either of them should work in both SNMP v1 and v2c. If you enable pysnmp debugging that might help figuring out what value and type is coming from your Agent. from pysnmp import debug debug.setLogger(debug.Debug('msgproc', 'secmod', 'proxy')) -ilya On 23 May 2014, at 22:49, Johnny Costello <bla...@gm...> wrote: > Thank you IIlya, that worked for me for the Counter64 object. > > How about a Gauge32 object. I tried using setting the version to 1 or 2 and I still get back a empty string. > > -Johnny > > > On Fri, May 16, 2014 at 8:19 AM, Ilya Etingof <il...@gl...> wrote: > > Hi Johnny, > > The COUNTER64 type only exists in SNMPv2c and later SNMP versions. You are using pysnmp in a way that makes it talking SNMPv1 with your Agent. In that case you would not be getting 64-bit values. > > So try passing 1 as the last option of CommunityData() call or just omit it (as SNMPv2c(1) is default there): > > cmdgen.CommunityData('agent', options.community, 1), > cmdgen.CommunityData('agent', options.community), > > -ilya > > > On 05/15/14 22:12, Johnny Costello wrote: > I have a script where I am getting values from a LB and ASA using the > MIB’s. I can retrieve most values fine but when I try to retrieve a > Counter64 value I get nothing. I can use the same MIB’s and do a snap > walk just fine but not with the Python Script. > > > Here is my example. > > Using snmpwalk I get > > IF-MIB::ifHCInOctets.2 = Counter64: 397233398 > > IF-MIB::ifHCInOctets.3 = Counter64: 5351734490175 > > IF-MIB::ifHCInOctets.4 = Counter64: 4813975040688 > > > When I use the pysnmp I get nothing back > > errorIndication, errorStatus, errorIndex, ifHCInOctets = > cmdgen.CommandGenerator().nextCmd( > > cmdgen.CommunityData('agent', options.community, 0), > > cmdgen.UdpTransportTarget((target_host, options.snmpport)), > > (1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 6)) > > > length 0 Result [] > > Error Indication None Error Status 0 Error Index > > The only difference I can see with this and all the other results I am > getting back is that the result is a Counter64 object. I can get a > Counter32 object and any other type without any issues just nothing for > a Counter64. > > > Thank you > > > > > ------------------------------------------------------------------------------ > "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE > Instantly run your Selenium tests across 300+ browser/OS combos. > Get unparalleled scalability from the best Selenium testing platform available > Simple to use. Nothing to install. Get started now for free." > http://p.sf.net/sfu/SauceLabs_______________________________________________ > pysnmp-users mailing list > pys...@li... > https://lists.sourceforge.net/lists/listinfo/pysnmp-users |
From: Johnny C. <bla...@gm...> - 2014-05-23 18:50:07
|
Thank you IIlya, that worked for me for the Counter64 object. How about a Gauge32 object. I tried using setting the version to 1 or 2 and I still get back a empty string. -Johnny On Fri, May 16, 2014 at 8:19 AM, Ilya Etingof <il...@gl...> wrote: > > Hi Johnny, > > The COUNTER64 type only exists in SNMPv2c and later SNMP versions. You are > using pysnmp in a way that makes it talking SNMPv1 with your Agent. In that > case you would not be getting 64-bit values. > > So try passing 1 as the last option of CommunityData() call or just omit > it (as SNMPv2c(1) is default there): > > cmdgen.CommunityData('agent', options.community, 1), > cmdgen.CommunityData('agent', options.community), > > -ilya > > > On 05/15/14 22:12, Johnny Costello wrote: > >> I have a script where I am getting values from a LB and ASA using the >> MIB’s. I can retrieve most values fine but when I try to retrieve a >> Counter64 value I get nothing. I can use the same MIB’s and do a snap >> walk just fine but not with the Python Script. >> >> >> Here is my example. >> >> Using snmpwalk I get >> >> IF-MIB::ifHCInOctets.2 = Counter64: 397233398 >> >> IF-MIB::ifHCInOctets.3 = Counter64: 5351734490175 >> >> IF-MIB::ifHCInOctets.4 = Counter64: 4813975040688 >> >> >> When I use the pysnmp I get nothing back >> >> errorIndication, errorStatus, errorIndex, ifHCInOctets = >> cmdgen.CommandGenerator().nextCmd( >> >> cmdgen.CommunityData('agent', options.community, 0), >> >> cmdgen.UdpTransportTarget((target_host, options.snmpport)), >> >> (1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 6)) >> >> >> length 0 Result [] >> >> Error Indication None Error Status 0 Error Index >> >> The only difference I can see with this and all the other results I am >> getting back is that the result is a Counter64 object. I can get a >> Counter32 object and any other type without any issues just nothing for >> a Counter64. >> >> >> Thank you >> >> >> > |
From: Ilya E. <il...@gl...> - 2014-05-16 15:19:55
|
Hi Johnny, The COUNTER64 type only exists in SNMPv2c and later SNMP versions. You are using pysnmp in a way that makes it talking SNMPv1 with your Agent. In that case you would not be getting 64-bit values. So try passing 1 as the last option of CommunityData() call or just omit it (as SNMPv2c(1) is default there): cmdgen.CommunityData('agent', options.community, 1), cmdgen.CommunityData('agent', options.community), -ilya On 05/15/14 22:12, Johnny Costello wrote: > I have a script where I am getting values from a LB and ASA using the > MIB’s. I can retrieve most values fine but when I try to retrieve a > Counter64 value I get nothing. I can use the same MIB’s and do a snap > walk just fine but not with the Python Script. > > > Here is my example. > > Using snmpwalk I get > > IF-MIB::ifHCInOctets.2 = Counter64: 397233398 > > IF-MIB::ifHCInOctets.3 = Counter64: 5351734490175 > > IF-MIB::ifHCInOctets.4 = Counter64: 4813975040688 > > > When I use the pysnmp I get nothing back > > errorIndication, errorStatus, errorIndex, ifHCInOctets = > cmdgen.CommandGenerator().nextCmd( > > cmdgen.CommunityData('agent', options.community, 0), > > cmdgen.UdpTransportTarget((target_host, options.snmpport)), > > (1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 6)) > > > length 0 Result [] > > Error Indication None Error Status 0 Error Index > > The only difference I can see with this and all the other results I am > getting back is that the result is a Counter64 object. I can get a > Counter32 object and any other type without any issues just nothing for > a Counter64. > > > Thank you > > |
From: Craig S. <cs...@en...> - 2014-05-16 05:53:47
|
On Thu, May 15, 2014 at 11:12:41AM -0700, Johnny Costello wrote: > MIBa**s. I can retrieve most values fine but when I try to retrieve a > Counter64 value I get nothing. I can use the same MIBa**s and do a snap That sounds like a classic problem with SNMPv1 versus SNMPv2. Counter64 was introduced in version 2. > A A A A A A cmdgen.CommunityData('agent', options.community, 0), The third argument for cmdgen.CommunityData is the SNMP version. 0 means SNMPv1. To be able to fetch Counter64 values you need to be running v2 or v3. Change the 0 to 1 and it should be ok. - Craig -- Craig Small (@smallsees) http://enc.com.au/ csmall at : enc.com.au Debian GNU/Linux http://www.debian.org/ csmall at : debian.org GPG fingerprint: 5D2F B320 B825 D939 04D2 0519 3938 F96B DF50 FEA5 |
From: Johnny C. <bla...@gm...> - 2014-05-15 18:12:48
|
I have a script where I am getting values from a LB and ASA using the MIB’s. I can retrieve most values fine but when I try to retrieve a Counter64 value I get nothing. I can use the same MIB’s and do a snap walk just fine but not with the Python Script. Here is my example. Using snmpwalk I get IF-MIB::ifHCInOctets.2 = Counter64: 397233398 IF-MIB::ifHCInOctets.3 = Counter64: 5351734490175 IF-MIB::ifHCInOctets.4 = Counter64: 4813975040688 When I use the pysnmp I get nothing back errorIndication, errorStatus, errorIndex, ifHCInOctets = cmdgen.CommandGenerator().nextCmd( cmdgen.CommunityData('agent', options.community, 0), cmdgen.UdpTransportTarget((target_host, options.snmpport)), (1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 6)) length 0 Result [] Error Indication None Error Status 0 Error Index The only difference I can see with this and all the other results I am getting back is that the result is a Counter64 object. I can get a Counter32 object and any other type without any issues just nothing for a Counter64. Thank you |
From: Ilya E. <il...@gl...> - 2014-04-30 14:46:57
|
Hi Markus, Please upgrade to the latest pysnmp (4.2.5). These example scripts are suited to work with more-or-less modern pysnmp. Also, if you check pysnmp changelog, 4.2.5 is way better than 4.1.9a in terms of bugs and features. -ilya On 04/30/2014 05:41 PM, new...@ao... wrote: > Hi, > > I should write a Python script which fires a SNMP v3 trap if an error > is detected. > > After reading some examples my machine has some problems to run the > examples which are given. I have problems to find the correct > documentation. > > Here some examples with version pysnmp 4.1.9a, on Ubuntu 12.04 and > Python 2.7. > > >>> from pysnmp.entity.rfc3413.oneliner import cmdgen > >>> ntforg.CommunityData('public') > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > TypeError: __init__() takes at least 3 arguments (2 given) > > >>> from pysnmp.entity.rfc3413.oneliner import cmdgen > >>> cmdgen.MibVariable('SNMPv2-MIB', 'sysDescr', 0) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > AttributeError: 'module' object has no attribute 'MibVariable' > > > >>> from pysnmp.proto.api import v2c > >>> v2c.OctetString(hexValue='8000000001020304') > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > TypeError: __init__() got an unexpected keyword argument 'hexValue' > > The examples are coming from the official page: > http://pysnmp.sourceforge.net/quickstart.html > http://pysnmp.sourceforge.net/examples/current/v3arch/agent/ntforg/trap-v3.html > > Because Google could help in my case I have the assumption that I > missed something. Does anybody know what I did wrong? > For first problem told me that an argument is missing. Where can I > found the documentation to find out which parameter? > The second one tells me that a module is missing. Which one? Will be > SNMPv2-MIB on my machine? > The last one tells me that hexValue is unknown. Where can I found the > documentation to eliminate this problem? > > Thanks in advance, > Markus > > |
From: <new...@ao...> - 2014-04-30 14:04:19
|
Hi, I should write a Python script which fires a SNMP v3 trap if an error is detected. After reading some examples my machine has some problems to run the examples which are given. I have problems to find the correct documentation. Here some examples with version pysnmp 4.1.9a, on Ubuntu 12.04 and Python 2.7. >>> from pysnmp.entity.rfc3413.oneliner import cmdgen >>> ntforg.CommunityData('public') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: __init__() takes at least 3 arguments (2 given) >>> from pysnmp.entity.rfc3413.oneliner import cmdgen >>> cmdgen.MibVariable('SNMPv2-MIB', 'sysDescr', 0) Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'MibVariable' >>> from pysnmp.proto.api import v2c >>> v2c.OctetString(hexValue='8000000001020304') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: __init__() got an unexpected keyword argument 'hexValue' The examples are coming from the official page: http://pysnmp.sourceforge.net/quickstart.html http://pysnmp.sourceforge.net/examples/current/v3arch/agent/ntforg/trap-v3.html Because Google could help in my case I have the assumption that I missed something. Does anybody know what I did wrong? For first problem told me that an argument is missing. Where can I found the documentation to find out which parameter? The second one tells me that a module is missing. Which one? Will be SNMPv2-MIB on my machine? The last one tells me that hexValue is unknown. Where can I found the documentation to eliminate this problem? Thanks in advance, Markus |
From: Ilya E. <il...@gl...> - 2014-04-29 06:45:02
|
That is the address your Agent is listening for incoming packets. If you use specific address (e.g. 127.0.0.1), the Agent will respond to requests sent to it but will not listen at other local addresses. To listen on all local interfaces you should bind to 0.0.0.0. -ilya On 29 Apr 2014, at 00:51, Christiano SA <chr...@en...> wrote: > Before: > > # UDP over IPv4 > config.addSocketTransport( > snmpEngine, > udp.domainName, > udp.UdpTransport().openServerMode(('127.0.0.1', 161)) > ) > > After: > > # UDP over IPv4 > config.addSocketTransport( > snmpEngine, > udp.domainName, > udp.UdpTransport().openServerMode(('192.168.0.11', 161)) # replace 127.0.0.1 ---> your Ip like 192.168.0.11 > ) > > I do not know why it worked, but it helped me a lot. |
From: Christiano S. <chr...@en...> - 2014-04-28 20:51:39
|
Before: # UDP over IPv4 config.addSocketTransport( snmpEngine, udp.domainName, udp.UdpTransport().openServerMode(('127.0.0.1', 161)) ) After: # UDP over IPv4 config.addSocketTransport( snmpEngine, udp.domainName, udp.UdpTransport().openServerMode(('192.168.0.11', 161)) # replace 127.0.0.1 ---> your Ip like 192.168.0.11 ) I do not know why it worked, but it helped me a lot. |
From: Christiano S. <chr...@en...> - 2014-04-27 16:54:03
|
Hi Craig, you helped me find the problem: WRONG LINE: config.addVacmUser(snmpEngine, 2, 'my-area', 'noAuthNoPriv', (1,3,6,5)) Correction: config.addVacmUser(snmpEngine, 2, 'my-area', 'noAuthNoPriv', (1,3,6,1)) Now is working, thank you! > ----- Original Message ----- > From: Craig Small > Sent: 04/27/14 06:42 AM > To: pys...@li... > Subject: Re: [pysnmp-users] Table implementation Pysnmp > > It means you get a have an access problem. Either you have used the wrong community or the device's snmp setup does not permit you to access that part of the MIB. |
From: Craig S. <cs...@en...> - 2014-04-27 09:42:34
|
It means you get a have an access problem. Either you have used the wrong community or the device's snmp setup does not permit you to access that part of the MIB. |
From: Christiano S. <chr...@en...> - 2014-04-27 07:30:50
|
Hi, my tree is: iso(1) \ \ \org(3) \ \ \dod(6) \ \ \internet(1) \ \ \private(4) \ \ \enterprise(1) \ \ \ufes(35374) \ \ \npd(1) \ \ \monitorTable(1) / / /monitorEntry(1) \ \ ___________________________________________ \| monitorIndex | monitorTemp | monitorUmid | | 0 'asd' 'fghfgh' | | 1 'qweqwe' 'oipooip' | |___________________________________________| My code is attached. My test: # snmpget -v2c -cpublic localhost 1.3.6.1.4.1.35374.1.1.1.2.0 Expected: 'asd' Answer: Error in packet Reason: noAccess Failed object: SNMPv2-SMI::enterprises.35374.1.1.1.2.0 What did I do wrong? Thank you very much. |
From: Craig S. <cs...@en...> - 2014-04-04 12:45:44
|
Hi, My project is all ok with snmp gets, now im trying to do snmp_sets I'm getting this error now: local/lib/python2.7/site-packages/pysnmp-4.2.4-py2.7.egg/pysnmp/entity/rfc3413/oneliner/cmdgen.py", line 244, in setCmd varVal = varName.getMibNode().getSyntax().clone(varVal) AttributeError: MibIdentifier instance has no attribute 'getSyntax' My varbind is [(MibVariable((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 14, 9598)), 6)] that looks right to me, so not sure of the error. -- Craig Small (@smallsees) http://enc.com.au/ csmall at : enc.com.au Debian GNU/Linux http://www.debian.org/ csmall at : debian.org GPG fingerprint: 5D2F B320 B825 D939 04D2 0519 3938 F96B DF50 FEA5 |
From: Ilya E. <il...@gl...> - 2014-03-29 10:44:28
|
This is just to let people know that we are experimenting with a tool that could let SNMP messages traversing firewalls in a secure manner and also perform some additional security checks, data modification and caching. This SNMP proxy forwarder app employs a client-server model where one piece (client) can send SNMP messages and the other (server) receive them. These parts communicate with each other through encrypted TCP links carrying SNMP messages from client to server or vice versa. Here we deliberately avoid using SNMP terminology (Agent & Manager) as we focus on system behaviour (client actively issues requests and server passively process them) what can be used for both SNMP Command and Notification type messages to be handled on common basis depending on the client/server placement relative to SNMP entities being served. Both parts of SNMP proxy talk all SNMP versions and can be configured to serve many SNMP peers. SNMP message routing can be done on both client and server based on SNMP credentials or transport addresses involved. As of this moment the SNMP proxy tool is more a work in progress rather than a finished product. Although it already can be used in straightforward situations like SNMP message relaying. No data modification or caching features are yet implemented. So we welcome you to test this new tool and let us know if you are interested in particular features: https://sourceforge.net/projects/snmpfwd/ You would need the latest development pysnmp source to run SNMP proxy forwarder: http://pysnmp.cvs.sourceforge.net/viewvc/pysnmp/pysnmp/?view=tar -ilya |
From: Ilya E. <il...@gl...> - 2014-03-28 05:49:41
|
Hi Susie, The .closeDispatcher() call will close all currently running transport objects (including their respective BSD sockets) and remove all callbacks (receive and timer) from dispatcher. Each transport object holds s single BSD socket. In client situation, this socket is used for sending out packets to many destinations. In server situation it is used for listening for incoming packets from multiple sources. If you need to shutdown individual transport, use transportObject = transportDispatcher.getTransport(transportDomain) transportDispatcher.unregisterTransport(transportObject) transportObject.close() With SNMP, transports are identified by transport-domain OIDs. To see all currently running transports you can use: transportDispatcher.getSocketMap() call which would return a dictionary of { socket: transportObject } If you observe suspiciously large number of open sockets, that may be a sign of excessive number of transports has being opened somehow. -ilya On 26 Mar 2014, at 15:31, Susie Murphy <sus...@gm...> wrote: > Hi, > I have some code which currently calls: > > transportDispatcher.runDispatcher() > > Which connects to my connections, doing what I want. Everything works, however the dispatcher is never explicitly closed in my code. Which I think is causing some problems of open UDP connections upon errors (this script is always running, rarely restarted). > > What is the safe way to close? I know I can just do > > try: > transportDispatcher.runDispatcher() > except Exception as e: > transportDispatcher.closeDispatcher() > raise e > > Will this allow all connections to finish? i.e. if a few connections fail to connect, raise an error, what happens? > Do the rest/current connections get to finish/connect, and once all are finished, it will then raise the exception? So everything will get to connect and finish? > > I'm assuming this is the case, but I'd l'd like to be 100% sure. > > Thanks, > Susie > - |
From: Susie M. <sus...@gm...> - 2014-03-26 11:32:11
|
Hi, I have some code which currently calls: transportDispatcher.runDispatcher() Which connects to my connections, doing what I want. Everything works, however the dispatcher is never explicitly closed in my code. Which I think is causing some problems of open UDP connections upon errors (this script is always running, rarely restarted). What is the safe way to close? I know I can just do try: transportDispatcher.runDispatcher() except Exception as e: transportDispatcher.closeDispatcher() raise e Will this allow all connections to finish? i.e. if a few connections fail to connect, raise an error, what happens? Do the rest/current connections get to finish/connect, and once all are finished, it will then raise the exception? So everything will get to connect and finish? I'm assuming this is the case, but I'd l'd like to be 100% sure. Thanks, Susie |
From: Craig S. <cs...@en...> - 2014-02-24 21:42:24
|
On Mon, Feb 24, 2014 at 10:43:55AM +0400, Ilya Etingof wrote: > The reason why snmpget work may be that Net-SNMP engine does not verify > SNMP community name / version in response. But that would be totally > weird. Would also be a good way to mess with sysadmin minds. You could spoof the reply packet using any community you like and as long as it is not the SNMPv3 packet which encrypts the lot you could get the sequence number for your evil packet. I know that's not helping Johnny, but I might have to fool around with the snmp binaries to see for myself. - Craig -- Craig Small (@smallsees) http://enc.com.au/ csmall at : enc.com.au Debian GNU/Linux http://www.debian.org/ csmall at : debian.org GPG fingerprint: 5D2F B320 B825 D939 04D2 0519 3938 F96B DF50 FEA5 |
From: Ilya E. <il...@gl...> - 2014-02-24 06:44:05
|
Hi Johnny, It looks like the JBOSS SNMP Agent responds with incorrect SNMP community name and SNMP version. To prove my guess and make sure it’s not a pysnmp issue, it would be helpful to capture network traffic (with Wireshark) to make sure that lame data appear in response in both cases - when pysnmp and Net-SNMP Managers are used. As debug shows, you seem to use SNMP v1 in request (however you pysnmp script below uses SNMP v2c). Could you try using SNMP v2c in hope that would not trigger incorrect response by JBOSS? cmdgen.CommunityData(‘t4uuii8guqlszh89qxy9’, mpModel=1) Another idea is to try to use SNMP community name ‘public’ in request as JBOSS seems to use it in response regardless of community name came in request. The reason why snmpget work may be that Net-SNMP engine does not verify SNMP community name / version in response. But that would be totally weird. -ilya On 21 Feb 2014, at 02:11, Johnny Tardin <joh...@gm...> wrote: > The command is: > > root@RJODCAS009:~/snmp# snmpget -On -v2c -c t4uuii8guqlszh89qxy9 10.6.0.13:1161 1.3.6.1.4.1.32730.102.1.2 1.3.6.1.4.1.32730.102.1.1 > .1.3.6.1.4.1.32730.102.1.2 = Gauge32: 0 > .1.3.6.1.4.1.32730.102.1.1 = Gauge32: 492 > > > > Atenciosamente, > > Johnny Pinheiro Tardin > > > -- > > > On Thu, Feb 20, 2014 at 6:57 PM, Johnny Tardin <joh...@gm...> wrote: > Hi, > > My Jboss SNMP Agent is running on port 1161 because my net-snmp is ruuning on 161. > > I ran with debug and the result is (log attached) : > > DBG: [18:47:00.168]: StatusInformation: {'errorIndication': <pysnmp.proto.errind.UnknownCommunityName instance at 0x9eac50c>} > > Request: > The PDU request is with my community, but de response is with public community. > version=1 > community=t4uuii8guqlszh89qxy9 > data=PDUs: > get-request=GetRequestPDU: > request-id=4814303 > error-status='noError' > error-index=0 > variable-bindings=VarBindList: > VarBind: > name=1.3.6.1.4.1.32730.102.1.2 > =_BindValue: > unSpecified= > > VarBind: > name=1.3.6.1.4.1.32730.102.1.1 > =_BindValue: > unSpecified= > > > Response: > version='version-2c' > community=public > data=PDUs: > response=ResponsePDU: > request-id=4814303 > error-status='noError' > error-index=0 > variable-bindings=VarBindList: > VarBind: > name=1.3.6.1.4.1.32730.102.1.2 > =_BindValue: > value=ObjectSyntax: > application-wide=ApplicationSyntax: > gauge32-value=0 > > > > VarBind: > name=1.3.6.1.4.1.32730.102.1.1 > =_BindValue: > value=ObjectSyntax: > application-wide=ApplicationSyntax: > gauge32-value=523 > > Thanks > > > Atenciosamente, > > Johnny Pinheiro Tardin > > > -- > > > On Thu, Feb 20, 2014 at 6:16 PM, Ilya Etingof <il...@gl...> wrote: > > Hi Johnny, > > Your script looks good except you are using a non-standard SNMP port (1161), the standard is 161. Is your JBOSS Agent listening on port 1161, not 161? > > What is the exact snmpget command line that successfully fetches data from JBOSS Agent? > > -ilya > > On 20 Feb 2014, at 03:49, Johnny Tardin <joh...@gm...> wrote: > > > Hi all, > > > > I'm writing a script that get snmp on Jboss. > > When i try to collect data in Jboss, i get the message: > > > > "No SNMP response received before timeout" > > > > But, when i try to get in Net-SNMP (Linux SO) with pysnmp i have success. > > > > If I do snmpget with command line i have success. > > > > My code: > > > > > > ########### > > from pysnmp.entity.rfc3413.oneliner import cmdgen > > > > cmdGen = cmdgen.CommandGenerator() > > > > errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd( > > cmdgen.CommunityData('communityexample'), > > cmdgen.UdpTransportTarget(('192.168.1.11', 1161)), > > '.1.3.6.1.4.1.32730.116.2.1', > > '.1.3.6.1.4.1.32730.116.2.2' > > ) > > > > # Check for errors and print out results > > if errorIndication: > > print(errorIndication) > > else: > > if errorStatus: > > print('%s at %s' % ( > > errorStatus.prettyPrint(), > > errorIndex and varBinds[int(errorIndex)-1] or '?' > > ) > > ) > > else: > > for name, val in varBinds: > > print('%s = %s' % (name.prettyPrint(), val.prettyPrint())) > > > > > > |
From: Craig S. <cs...@en...> - 2014-02-20 23:03:59
|
On Thu, Feb 20, 2014 at 06:57:27PM -0300, Johnny Tardin wrote: > Request: > version=1 > community=t4uuii8guqlszh89qxy9 [...] > Response: > version='version-2c' > community=public That's a bit odd. To me that's broken behaviour. Not only the community changed between the request and response, but the SNMP version changed too. Or... is it the way it is presented? is int(1)=v2c and int(0)=v1? - Craig -- Craig Small (@smallsees) http://enc.com.au/ csmall at : enc.com.au Debian GNU/Linux http://www.debian.org/ csmall at : debian.org GPG fingerprint: 5D2F B320 B825 D939 04D2 0519 3938 F96B DF50 FEA5 |
From: Johnny T. <joh...@gm...> - 2014-02-20 22:12:25
|
The command is: root@RJODCAS009:~/snmp# snmpget -On -v2c -c t4uuii8guqlszh89qxy9 10.6.0.13:1161 1.3.6.1.4.1.32730.102.1.2 1.3.6.1.4.1.32730.102.1.1 .1.3.6.1.4.1.32730.102.1.2 = Gauge32: 0 .1.3.6.1.4.1.32730.102.1.1 = Gauge32: 492 Atenciosamente, Johnny Pinheiro Tardin -- On Thu, Feb 20, 2014 at 6:57 PM, Johnny Tardin <joh...@gm...>wrote: > Hi, > > My Jboss SNMP Agent is running on port 1161 because my net-snmp is ruuning > on 161. > > I ran with debug and the result is (log attached) : > > DBG: [18:47:00.168]: StatusInformation: {'errorIndication': > <pysnmp.proto.errind.UnknownCommunityName instance at 0x9eac50c>} > > Request: > The PDU request is with my community, but de response is with public > community. > version=1 > community=*t4uuii8guqlszh89qxy9* > data=PDUs: > get-request=GetRequestPDU: > request-id=4814303 > error-status='noError' > error-index=0 > variable-bindings=VarBindList: > VarBind: > name=1.3.6.1.4.1.32730.102.1.2 > =_BindValue: > unSpecified= > > VarBind: > name=1.3.6.1.4.1.32730.102.1.1 > =_BindValue: > unSpecified= > > > Response: > version='version-2c' > community=*public* > data=PDUs: > response=ResponsePDU: > request-id=4814303 > error-status='noError' > error-index=0 > variable-bindings=VarBindList: > VarBind: > name=1.3.6.1.4.1.32730.102.1.2 > =_BindValue: > value=ObjectSyntax: > application-wide=ApplicationSyntax: > gauge32-value=0 > > > > VarBind: > name=1.3.6.1.4.1.32730.102.1.1 > =_BindValue: > value=ObjectSyntax: > application-wide=ApplicationSyntax: > gauge32-value=523 > > Thanks > > > Atenciosamente, > > Johnny Pinheiro Tardin > > > -- > > > On Thu, Feb 20, 2014 at 6:16 PM, Ilya Etingof <il...@gl...> wrote: > >> >> Hi Johnny, >> >> Your script looks good except you are using a non-standard SNMP port >> (1161), the standard is 161. Is your JBOSS Agent listening on port 1161, >> not 161? >> >> What is the exact snmpget command line that successfully fetches data >> from JBOSS Agent? >> >> -ilya >> >> On 20 Feb 2014, at 03:49, Johnny Tardin <joh...@gm...> wrote: >> >> > Hi all, >> > >> > I'm writing a script that get snmp on Jboss. >> > When i try to collect data in Jboss, i get the message: >> > >> > "No SNMP response received before timeout" >> > >> > But, when i try to get in Net-SNMP (Linux SO) with pysnmp i have >> success. >> > >> > If I do snmpget with command line i have success. >> > >> > My code: >> > >> > >> > ########### >> > from pysnmp.entity.rfc3413.oneliner import cmdgen >> > >> > cmdGen = cmdgen.CommandGenerator() >> > >> > errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd( >> > cmdgen.CommunityData('communityexample'), >> > cmdgen.UdpTransportTarget(('192.168.1.11', 1161)), >> > '.1.3.6.1.4.1.32730.116.2.1', >> > '.1.3.6.1.4.1.32730.116.2.2' >> > ) >> > >> > # Check for errors and print out results >> > if errorIndication: >> > print(errorIndication) >> > else: >> > if errorStatus: >> > print('%s at %s' % ( >> > errorStatus.prettyPrint(), >> > errorIndex and varBinds[int(errorIndex)-1] or '?' >> > ) >> > ) >> > else: >> > for name, val in varBinds: >> > print('%s = %s' % (name.prettyPrint(), val.prettyPrint())) >> > >> > >> > > |
From: Ilya E. <il...@gl...> - 2014-02-20 21:16:55
|
Hi Johnny, Your script looks good except you are using a non-standard SNMP port (1161), the standard is 161. Is your JBOSS Agent listening on port 1161, not 161? What is the exact snmpget command line that successfully fetches data from JBOSS Agent? -ilya On 20 Feb 2014, at 03:49, Johnny Tardin <joh...@gm...> wrote: > Hi all, > > I'm writing a script that get snmp on Jboss. > When i try to collect data in Jboss, i get the message: > > "No SNMP response received before timeout" > > But, when i try to get in Net-SNMP (Linux SO) with pysnmp i have success. > > If I do snmpget with command line i have success. > > My code: > > > ########### > from pysnmp.entity.rfc3413.oneliner import cmdgen > > cmdGen = cmdgen.CommandGenerator() > > errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd( > cmdgen.CommunityData('communityexample'), > cmdgen.UdpTransportTarget(('192.168.1.11', 1161)), > '.1.3.6.1.4.1.32730.116.2.1', > '.1.3.6.1.4.1.32730.116.2.2' > ) > > # Check for errors and print out results > if errorIndication: > print(errorIndication) > else: > if errorStatus: > print('%s at %s' % ( > errorStatus.prettyPrint(), > errorIndex and varBinds[int(errorIndex)-1] or '?' > ) > ) > else: > for name, val in varBinds: > print('%s = %s' % (name.prettyPrint(), val.prettyPrint())) > > |
From: Johnny T. <joh...@gm...> - 2014-02-19 23:50:02
|
Hi all, I'm writing a script that get snmp on Jboss. When i try to collect data in Jboss, i get the message: "No SNMP response received before timeout" But, when i try to get in Net-SNMP (Linux SO) with pysnmp i have success. If I do snmpget with command line i have success. My code: ########### from pysnmp.entity.rfc3413.oneliner import cmdgen cmdGen = cmdgen.CommandGenerator() errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd( cmdgen.CommunityData('communityexample'), cmdgen.UdpTransportTarget(('192.168.1.11', 1161)), '.1.3.6.1.4.1.32730.116.2.1', '.1.3.6.1.4.1.32730.116.2.2' ) # Check for errors and print out results if errorIndication: print(errorIndication) else: if errorStatus: print('%s at %s' % ( errorStatus.prettyPrint(), errorIndex and varBinds[int(errorIndex)-1] or '?' ) ) else: for name, val in varBinds: print('%s = %s' % (name.prettyPrint(), val.prettyPrint())) |
From: Ilya E. <il...@gl...> - 2014-01-11 19:44:01
|
Hi Michael, I've checked your code so I still think that handleMgmtOperation()is called once per request (e.g. per-PDU). I suspect your proxy got two independent requests from SNMP Manager. You could check that by enabling pysnmp debugging like this: from pysnmp import debug debug.setLogger(debug.Debug('msgproc')) A few more comments: * You current implementation does not seem to handle GETNEXT/GETBULK in which case OID in request might not be the same as OID to put in response. This may or may not be a desirable behavior. * You seem to be using internal pysnmp cache to lookup peer address: hosts = snmpEngine.cache['getTargetAddr']['nameToTargetMap'] This is not reliable as pysnmp caching mechanics may change in the future. I suggest you trying to use the latest pysnmp feature called 'request observer'. The following call will get you a dictionary holding many details on *current* request including peer transport endpoint: execContext = snmpEngine.observer.getExecutionContext( 'rfc3412.receiveMessage:request' ) You would have to use the latest development pysnmp code from here: http://pysnmp.cvs.sourceforge.net/viewvc/pysnmp/pysnmp/?view=tar Let me know if you need further help. -ilya On 01/09/14 13:25, Ilya Etingof wrote: > > Hello, Michael! > > The handleMgmtOperation() should get called once for a PDU for all > var-binds in there. I’ll take a look at the code shortly. > > As a side note, there may be a problem with building response > var-bindings from plain Python objects (str, int) which are probably > taken from cache. Instead you should either cache original pysnmp > objects (as you receive in response) or cast plain Python objects into > pysnmp ones respecting their SNMP types that are appropriate for a given > OID. > > The first approach is probably easier to implement if your caching > backend supports user objects (or you’d have to pickle them into > strings). In the second case you would have to cache both Python values > and an indication of their original SNMP type (Integer, Counter, > ObjectIdentifier etc.) what would let you reconstruct pysnmp objects > from Python once at the moment of building response. > > -ilya > > On 30 Dec 2013, at 18:32, Michael Kehoe <mic...@gm... > <mailto:mic...@gm...>> wrote: > >> Hi Ilya, >> >> I was hoping you could help me further. (code at: >> https://github.com/michael-kehoe/scroxy) >> >> It seems that for every key in varbind, the handleMgmtOperation >> function gets called, which I didn't think should happen. >> >> Can you help me restructure my code so I can get my caching proxy working? >> >> My program prints the following debugging info: >> Begin of handleMgmtOperation >> Beginning to check all of cache >> Checking cache for oid: 1.3.6.1.2.1 >> Not all entries cached: 1.3.6.1.2.1 >> Not all cached - sending request >> Caching Key: 192.168.0.5-1.3.6.1.2.1.1.1.0 >> Sending uncached response to client >> Begin of handleMgmtOperation >> Beginning to check all of cache >> Checking cache for oid: 1.3.6.1.2.1.1.1.0 >> Key Cached: 1.3.6.1.2.1.1.1.0 >> All cached - sending cached response >> Traceback (most recent call last): >> File "scroxy.py", line 183, in <module> >> snmpEngine.transportDispatcher.runDispatcher() >> File >> "/usr/local/lib/python2.7/dist-packages/pysnmp/carrier/asynsock/dispatch.py", >> line 33, in runDispatcher >> poll(timeout and timeout or self.timeout, self.__sockMap) >> File "/usr/lib/python2.7/asyncore.py", line 156, in poll >> read(obj) >> File "/usr/lib/python2.7/asyncore.py", line 87, in read >> obj.handle_error() >> File "/usr/lib/python2.7/asyncore.py", line 83, in read >> obj.handle_read_event() >> File "/usr/lib/python2.7/asyncore.py", line 447, in handle_read_event >> self.handle_read() >> File >> "/usr/local/lib/python2.7/dist-packages/pysnmp/carrier/asynsock/dgram/base.py", >> line 83, in handle_read >> self._cbFun(self, transportAddress, incomingMessage) >> File "/usr/local/lib/python2.7/dist-packages/pysnmp/carrier/base.py", >> line 44, in _cbFun >> self, transportDomain, transportAddress, incomingMessage >> File "/usr/local/lib/python2.7/dist-packages/pysnmp/entity/engine.py", >> line 63, in __receiveMessageCbFun >> self, transportDomain, transportAddress, wholeMsg >> File "/usr/local/lib/python2.7/dist-packages/pysnmp/proto/rfc3412.py", >> line 406, in receiveMessage >> stateReference >> File >> "/usr/local/lib/python2.7/dist-packages/pysnmp/entity/rfc3413/cmdrsp.py", >> line 145, in processPdu >> contextName, PDU, (self.__verifyAccess, acCtx) >> File "scroxy.py", line 139, in handleMgmtOperation >> self.sendRsp(snmpEngine, stateReference, 0, 0, varBinds) >> File >> "/usr/local/lib/python2.7/dist-packages/pysnmp/entity/rfc3413/cmdrsp.py", >> line 47, in sendRsp >> v2c.apiPDU.setVarBinds(PDU, varBinds) >> File "/usr/local/lib/python2.7/dist-packages/pysnmp/proto/api/v1.py", >> line 101, in setVarBinds >> varBindList.getComponentByPosition(idx), varBind >> File "/usr/local/lib/python2.7/dist-packages/pysnmp/proto/api/v1.py", >> line 33, in setOIDVal >> varBind.setComponentByPosition(1).getComponentByPosition(1).setComponentByType(val.getTagSet(), >> val, 1, verifyConstraints=False) >> AttributeError: 'str' object has no attribute 'getTagSet' >> >> >> Regards >> Michael >> >> >> >> >> On Fri, Oct 25, 2013 at 5:04 PM, Ilya Etingof <il...@gl... >> <mailto:il...@gl...>> wrote: >> >> Hi Michael, >> >> You should first update your response varBinds completely, the >> send a single response containing the whole varBinds list. You are >> currently seem to send varBinds in many responses to a single >> request what is illegal from SNMP standpoint. >> >> Let me know if you need help with this. >> >> -ilya >> >> On 24 Oct 2013, at 11:30, Michael Kehoe <mic...@gm... >> <mailto:mic...@gm...>> wrote: >> >> > Hi all, >> > >> > With Ilya's help, I've been working on a SNMP proxy that caches >> the result in redis (to reduce the number of requests that make it >> to devices). >> > I'm having problems with returning the cached result and I >> believe the problem is coming from line 126. >> > >> > Would someone be able to have a look and give me some help? >> > The code is at: https://github.com/michael-kehoe/scroxy >> > >> > Regards >> > Michael Kehoe >> > >> ------------------------------------------------------------------------------ >> >> >> ------------------------------------------------------------------------------ >> October Webinars: Code for Performance >> Free Intel webinars can help you accelerate application performance. >> Explore tips for MPI, OpenMP, advanced profiling, and more. Get >> the most from >> the latest Intel processors and coprocessors. See abstracts and >> register > >> http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk >> <http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk> >> _______________________________________________ >> pysnmp-users mailing list >> pys...@li... >> <mailto:pys...@li...> >> https://lists.sourceforge.net/lists/listinfo/pysnmp-users >> >> > > > > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments& Everything In Between. > Get a Quote or Start a Free Trial Today. > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > > > > _______________________________________________ > pysnmp-users mailing list > pys...@li... > https://lists.sourceforge.net/lists/listinfo/pysnmp-users |
From: Ilya E. <il...@gl...> - 2014-01-09 09:26:02
|
Hello, Michael! The handleMgmtOperation() should get called once for a PDU for all var-binds in there. I’ll take a look at the code shortly. As a side note, there may be a problem with building response var-bindings from plain Python objects (str, int) which are probably taken from cache. Instead you should either cache original pysnmp objects (as you receive in response) or cast plain Python objects into pysnmp ones respecting their SNMP types that are appropriate for a given OID. The first approach is probably easier to implement if your caching backend supports user objects (or you’d have to pickle them into strings). In the second case you would have to cache both Python values and an indication of their original SNMP type (Integer, Counter, ObjectIdentifier etc.) what would let you reconstruct pysnmp objects from Python once at the moment of building response. -ilya On 30 Dec 2013, at 18:32, Michael Kehoe <mic...@gm...> wrote: > Hi Ilya, > > I was hoping you could help me further. (code at: https://github.com/michael-kehoe/scroxy) > > It seems that for every key in varbind, the handleMgmtOperation function gets called, which I didn't think should happen. > > Can you help me restructure my code so I can get my caching proxy working? > > My program prints the following debugging info: > Begin of handleMgmtOperation > Beginning to check all of cache > Checking cache for oid: 1.3.6.1.2.1 > Not all entries cached: 1.3.6.1.2.1 > Not all cached - sending request > Caching Key: 192.168.0.5-1.3.6.1.2.1.1.1.0 > Sending uncached response to client > Begin of handleMgmtOperation > Beginning to check all of cache > Checking cache for oid: 1.3.6.1.2.1.1.1.0 > Key Cached: 1.3.6.1.2.1.1.1.0 > All cached - sending cached response > Traceback (most recent call last): > File "scroxy.py", line 183, in <module> > snmpEngine.transportDispatcher.runDispatcher() > File "/usr/local/lib/python2.7/dist-packages/pysnmp/carrier/asynsock/dispatch.py", line 33, in runDispatcher > poll(timeout and timeout or self.timeout, self.__sockMap) > File "/usr/lib/python2.7/asyncore.py", line 156, in poll > read(obj) > File "/usr/lib/python2.7/asyncore.py", line 87, in read > obj.handle_error() > File "/usr/lib/python2.7/asyncore.py", line 83, in read > obj.handle_read_event() > File "/usr/lib/python2.7/asyncore.py", line 447, in handle_read_event > self.handle_read() > File "/usr/local/lib/python2.7/dist-packages/pysnmp/carrier/asynsock/dgram/base.py", line 83, in handle_read > self._cbFun(self, transportAddress, incomingMessage) > File "/usr/local/lib/python2.7/dist-packages/pysnmp/carrier/base.py", line 44, in _cbFun > self, transportDomain, transportAddress, incomingMessage > File "/usr/local/lib/python2.7/dist-packages/pysnmp/entity/engine.py", line 63, in __receiveMessageCbFun > self, transportDomain, transportAddress, wholeMsg > File "/usr/local/lib/python2.7/dist-packages/pysnmp/proto/rfc3412.py", line 406, in receiveMessage > stateReference > File "/usr/local/lib/python2.7/dist-packages/pysnmp/entity/rfc3413/cmdrsp.py", line 145, in processPdu > contextName, PDU, (self.__verifyAccess, acCtx) > File "scroxy.py", line 139, in handleMgmtOperation > self.sendRsp(snmpEngine, stateReference, 0, 0, varBinds) > File "/usr/local/lib/python2.7/dist-packages/pysnmp/entity/rfc3413/cmdrsp.py", line 47, in sendRsp > v2c.apiPDU.setVarBinds(PDU, varBinds) > File "/usr/local/lib/python2.7/dist-packages/pysnmp/proto/api/v1.py", line 101, in setVarBinds > varBindList.getComponentByPosition(idx), varBind > File "/usr/local/lib/python2.7/dist-packages/pysnmp/proto/api/v1.py", line 33, in setOIDVal > varBind.setComponentByPosition(1).getComponentByPosition(1).setComponentByType(val.getTagSet(), val, 1, verifyConstraints=False) > AttributeError: 'str' object has no attribute 'getTagSet' > > > Regards > Michael > > > > > On Fri, Oct 25, 2013 at 5:04 PM, Ilya Etingof <il...@gl...> wrote: > Hi Michael, > > You should first update your response varBinds completely, the send a single response containing the whole varBinds list. You are currently seem to send varBinds in many responses to a single request what is illegal from SNMP standpoint. > > Let me know if you need help with this. > > -ilya > > On 24 Oct 2013, at 11:30, Michael Kehoe <mic...@gm...> wrote: > > > Hi all, > > > > With Ilya's help, I've been working on a SNMP proxy that caches the result in redis (to reduce the number of requests that make it to devices). > > I'm having problems with returning the cached result and I believe the problem is coming from line 126. > > > > Would someone be able to have a look and give me some help? > > The code is at: https://github.com/michael-kehoe/scroxy > > > > Regards > > Michael Kehoe > > ------------------------------------------------------------------------------ > > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk > _______________________________________________ > pysnmp-users mailing list > pys...@li... > https://lists.sourceforge.net/lists/listinfo/pysnmp-users > |
From: Michael K. <mic...@gm...> - 2013-12-30 14:32:37
|
Hi Ilya, I was hoping you could help me further. (code at: https://github.com/michael-kehoe/scroxy) It seems that for every key in varbind, the handleMgmtOperation function gets called, which I didn't think should happen. Can you help me restructure my code so I can get my caching proxy working? My program prints the following debugging info: Begin of handleMgmtOperation Beginning to check all of cache Checking cache for oid: 1.3.6.1.2.1 Not all entries cached: 1.3.6.1.2.1 Not all cached - sending request Caching Key: 192.168.0.5-1.3.6.1.2.1.1.1.0 Sending uncached response to client Begin of handleMgmtOperation Beginning to check all of cache Checking cache for oid: 1.3.6.1.2.1.1.1.0 Key Cached: 1.3.6.1.2.1.1.1.0 All cached - sending cached response Traceback (most recent call last): File "scroxy.py", line 183, in <module> snmpEngine.transportDispatcher.runDispatcher() File "/usr/local/lib/python2.7/dist-packages/pysnmp/carrier/asynsock/dispatch.py", line 33, in runDispatcher poll(timeout and timeout or self.timeout, self.__sockMap) File "/usr/lib/python2.7/asyncore.py", line 156, in poll read(obj) File "/usr/lib/python2.7/asyncore.py", line 87, in read obj.handle_error() File "/usr/lib/python2.7/asyncore.py", line 83, in read obj.handle_read_event() File "/usr/lib/python2.7/asyncore.py", line 447, in handle_read_event self.handle_read() File "/usr/local/lib/python2.7/dist-packages/pysnmp/carrier/asynsock/dgram/base.py", line 83, in handle_read self._cbFun(self, transportAddress, incomingMessage) File "/usr/local/lib/python2.7/dist-packages/pysnmp/carrier/base.py", line 44, in _cbFun self, transportDomain, transportAddress, incomingMessage File "/usr/local/lib/python2.7/dist-packages/pysnmp/entity/engine.py", line 63, in __receiveMessageCbFun self, transportDomain, transportAddress, wholeMsg File "/usr/local/lib/python2.7/dist-packages/pysnmp/proto/rfc3412.py", line 406, in receiveMessage stateReference File "/usr/local/lib/python2.7/dist-packages/pysnmp/entity/rfc3413/cmdrsp.py", line 145, in processPdu contextName, PDU, (self.__verifyAccess, acCtx) File "scroxy.py", line 139, in handleMgmtOperation self.sendRsp(snmpEngine, stateReference, 0, 0, varBinds) File "/usr/local/lib/python2.7/dist-packages/pysnmp/entity/rfc3413/cmdrsp.py", line 47, in sendRsp v2c.apiPDU.setVarBinds(PDU, varBinds) File "/usr/local/lib/python2.7/dist-packages/pysnmp/proto/api/v1.py", line 101, in setVarBinds varBindList.getComponentByPosition(idx), varBind File "/usr/local/lib/python2.7/dist-packages/pysnmp/proto/api/v1.py", line 33, in setOIDVal varBind.setComponentByPosition(1).getComponentByPosition(1).setComponentByType(val.getTagSet(), val, 1, verifyConstraints=False) AttributeError: 'str' object has no attribute 'getTagSet' Regards Michael On Fri, Oct 25, 2013 at 5:04 PM, Ilya Etingof <il...@gl...> wrote: > Hi Michael, > > You should first update your response varBinds completely, the send a > single response containing the whole varBinds list. You are currently seem > to send varBinds in many responses to a single request what is illegal from > SNMP standpoint. > > Let me know if you need help with this. > > -ilya > > On 24 Oct 2013, at 11:30, Michael Kehoe <mic...@gm...> wrote: > > > Hi all, > > > > With Ilya's help, I've been working on a SNMP proxy that caches the > result in redis (to reduce the number of requests that make it to devices). > > I'm having problems with returning the cached result and I believe the > problem is coming from line 126. > > > > Would someone be able to have a look and give me some help? > > The code is at: https://github.com/michael-kehoe/scroxy > > > > Regards > > Michael Kehoe > > > ------------------------------------------------------------------------------ > > > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk > _______________________________________________ > pysnmp-users mailing list > pys...@li... > https://lists.sourceforge.net/lists/listinfo/pysnmp-users > |