etingof / pysnmp

Python SNMP library
http://snmplabs.com/pysnmp/
BSD 2-Clause "Simplified" License
575 stars 193 forks source link

No SNMP response received before timeout #201

Open llllllizili opened 5 years ago

llllllizili commented 5 years ago

Thank you very much for your open source pysnmp When i use linux tool snmpwalk. I get the result

[root@11 ~]# snmpwalk -v 2c -c public 10.10.1.51 1.3.6.1.2.1.1.1.0
SNMPv2-MIB::sysDescr.0 = STRING: Cisco Adaptive Security Appliance Version 9.1(2)

But i get a problem when i am using snmpget.py .

[root@11 ~]# snmpget.py -v 2c -c public 10.10.1.51 1.3.6.1.2.1.1.1.0
No SNMP response received before timeout

How can I figure out the reason? pysnmp version is 4.4.4

etingof commented 5 years ago

This is curious. I suspect that may be the response is coming to/from a different IP address? Could you please add --debug io,msgproc to the snmpget.py command to see what's happening under the hood?

llllllizili commented 5 years ago

This is curious. I suspect that may be the response is coming to/from a different IP address? Could you please add --debug io,msgproc to the snmpget.py command to see what's happening under the hood?

Thanks for your reply, and I used the same ipaddress When i add --debug io,msgproc , The output is huge. I cut

....
2018-09-26 15:21:17,488 pysnmp: sendMessage: outgoingMessage queued (42 octets) 
00000: 30 28 02 01 01 04 06 70 75 62 6C 69 63 A0 1B 02 
00016: 03 6D E2 08 02 01 00 02 01 00 30 0E 30 0C 06 08 
00032: 2B 06 01 02 01 01 01 00 05 00
2018-09-26 15:21:17,489 pysnmp: handle_write: transportAddress <SnmpUDPAddress value object at 0x7fe0d429f210 subtypeSpec <ConstraintsIntersection object at 0x7fe0d40bf450 consts <ValueSizeConstraint object at 0x7fe0d508f6d0 consts 0, 65535>, <ValueSizeConstraint object at 0x7fe0d40bf4d0 consts 6, 6>> tagSet <TagSet object at 0x7fe0d83db390 tags 0:0:4> encoding iso-8859-1 payload [0.0.0.0/0]> -> ('10.10.1.51', 161) outgoingMessage (42 octets) 
00000: 30 28 02 01 01 04 06 70 75 62 6C 69 63 A0 1B 02 
00016: 03 6D E2 08 02 01 00 02 01 00 30 0E 30 0C 06 08 
00032: 2B 06 01 02 01 01 01 00 05 00
2018-09-26 15:21:18,491 pysnmp: StatusInformation: {'errorIndication': RequestTimedOut()}
2018-09-26 15:21:18,491 pysnmp: prepareOutgoingMessage: PDU request-id 8373303 replaced with unique ID 7201289
2018-09-26 15:21:18,492 pysnmp: prepareOutgoingMessage: using contextEngineId <SnmpEngineID value object at 0x7fe0d43b6490 subtypeSpec <ConstraintsIntersection object at 0x7fe0d43b6190 consts <ValueSizeConstraint object at 0x7fe0d508f6d0 consts 0, 65535>, <ValueSizeConstraint object at 0x7fe0d43b6150 consts 5, 32>> tagSet <TagSet object at 0x7fe0d83db390 tags 0:0:4> encoding iso-8859-1 payload [0x80004fb8057368...636d64622b6c3200]> contextName ''
2018-09-26 15:21:18,493 pysnmp: generateRequestMsg: Message:
 version=1
 community=public
 data=PDUs:
  get-request=GetRequestPDU:
   request-id=7201289
   error-status=noError
   error-index=0
   variable-bindings=VarBindList:
    VarBind:
     name=1.3.6.1.2.1.1.1.0
     =_BindValue:
      unSpecified=

2018-09-26 15:21:18,493 pysnmp: sendMessage: outgoingMessage queued (42 octets) 
00000: 30 28 02 01 01 04 06 70 75 62 6C 69 63 A0 1B 02 
00016: 03 6D E2 09 02 01 00 02 01 00 30 0E 30 0C 06 08 
00032: 2B 06 01 02 01 01 01 00 05 00
2018-09-26 15:21:18,494 pysnmp: handle_write: transportAddress <SnmpUDPAddress value object at 0x7fe0d429f210 subtypeSpec <ConstraintsIntersection object at 0x7fe0d40bf450 consts <ValueSizeConstraint object at 0x7fe0d508f6d0 consts 0, 65535>, <ValueSizeConstraint object at 0x7fe0d40bf4d0 consts 6, 6>> tagSet <TagSet object at 0x7fe0d83db390 tags 0:0:4> encoding iso-8859-1 payload [0.0.0.0/0]> -> ('10.10.1.51', 161) outgoingMessage (42 octets) 
00000: 30 28 02 01 01 04 06 70 75 62 6C 69 63 A0 1B 02 
00016: 03 6D E2 09 02 01 00 02 01 00 30 0E 30 0C 06 08 
00032: 2B 06 01 02 01 01 01 00 05 00
2018-09-26 15:21:19,496 pysnmp: StatusInformation: {'errorIndication': RequestTimedOut()}
...
napomokoetle commented 5 years ago

I'm also getting the same timeout error and would like to know the cause and possible solutions.

chaitas90 commented 5 years ago

Hello, I'm also getting same timeout error getting response with snmpwalk and when i try with pysnmp library for same system oid getting same response NO SNMP response received before timeout so please kindly provide solution for it..

etingof commented 5 years ago

Oh, sorry for forgetting this issue! You should have pinged it!

Thanks for your reply, and I used the same ipaddress

No, my suspicion is that your agent is responding from different IP, that may cause pysnmp to dropping response...

So to debug this we need more of the debugging output. Preferably complete log with 'io', 'msgproc' and 'seemed' options enabled.

Otherwise you need to look carefully into it yourself - first you need to find any incoming packet at all, if it's there you need to trace its further fate. Something must be wrong about it if it's dropped.

thichpv commented 4 years ago

Hello everyone,

I'm also getting same same issue. Please help me. Thanks

arun-vunet commented 3 years ago

Anything on this? Have we found the root cause for this issue? Has this been fixed in the later versions of pysnmp?

thichpv commented 3 years ago

Now, i not yet fixed this issue with pysnmp. But i used snmpget package on ubuntu with python process

valeriodigregorio commented 3 years ago

Any news here? I have the same issue but no clue of why I'm getting this. Version is 4.4.12

tg12 commented 2 years ago

Weird, Came here as I am having the same issue. Is there any fix for this?

Ajeet251298 commented 2 years ago

Hi, Did anyone get this issue resolved ? What could be the possible reason ?

lextm commented 1 day ago

NET-SNMP's snmpwalk has a larger timeout value, but based on the log entries shared, the timeout used are just 1 second,

2018-09-26 15:21:18,494 pysnmp: handle_write: transportAddress <SnmpUDPAddress value object at 0x7fe0d429f210 subtypeSpec <ConstraintsIntersection object at 0x7fe0d40bf450 consts <ValueSizeConstraint object at 0x7fe0d508f6d0 consts 0, 65535>, <ValueSizeConstraint object at 0x7fe0d40bf4d0 consts 6, 6>> tagSet <TagSet object at 0x7fe0d83db390 tags 0:0:4> encoding iso-8859-1 payload [0.0.0.0/0]> -> ('10.10.1.51', 161) outgoingMessage (42 octets) 
00000: 30 28 02 01 01 04 06 70 75 62 6C 69 63 A0 1B 02 
00016: 03 6D E2 09 02 01 00 02 01 00 30 0E 30 0C 06 08 
00032: 2B 06 01 02 01 01 01 00 05 00
2018-09-26 15:21:19,496 pysnmp: StatusInformation: {'errorIndication': RequestTimedOut()}

That might not be enough to get the response.

There can be quite a few other reasons to receive a timeout error, so the same logging approach should be used to collect the key information for troubleshooting.