0

I was trying too many things and hence I pasted the wrong code. Here is the code I am using

from pysnmp.entity.rfc3413.oneliner import cmdgen
from pysnmp.smi import *


cmdGen = cmdgen.CommandGenerator()

errorIndication, errorStatus, errorIndex, varBind = cmdGen.nextCmd(
    cmdgen.CommunityData('public', 1),
    cmdgen.UdpTransportTarget(('junipertestrtr', 161)),
    (1,3,6,1,4,1,2636,5,1,1,2,1,1,1,13,0,1),

)

print errorIndication, errorStatus

for varBindTableRow in varBind:
    for name, val in varBindTableRow:
        print name, val

When I run this program, I get the error message "requestTimedOut 0"

However when I run snmpwalk -c public -v 2c junipertestrtr 1.3.6.1.4.1.2636.5.1.1.2.1.1.1.13.0.1 from the same computer's command line I get the right output

iso.3.6.1.4.1.2636.5.1.1.2.1.1.1.13.0.1.172.28.254.83.1.172.16.25.82 = Gauge32: 64902 iso.3.6.1.4.1.2636.5.1.1.2.1.1.1.13.0.1.172.28.254.135.1.172.17.25.134 = Gauge32: 64902 iso.3.6.1.4.1.2636.5.1.1.2.1.1.1.13.0.1.172.28.255.135.1.172.29.255.136 = Gauge32: 64861 iso.3.6.1.4.1.2636.5.1.1.2.1.1.1.13.0.1.172.28.255.135.1.172.28.255.137 = Gauge32: 64861 iso.3.6.1.4.1.2636.5.1.1.2.1.1.1.13.0.1.172.28.255.135.1.172.28.255.138 = Gauge32: 64861 iso.3.6.1.4.1.2636.5.1.1.2.1.1.1.13.0.1.10.1.1.1.1.10.1.1.2 = Gauge32: 64810

what is wrong with my pysnmp and why am I getting a requestimedout error message?

  • You do not seem to be giving enough information - even the error line number does not seem to match. It would help to also provide the Python version you are using and the version of the libraries used (pysnmp). – donatello Aug 01 '13 at 12:59
  • Chances are you are using somewhat old release of pysnmp. Try to upgrade to the latest version. Or use old-style initialization like: cmdgen.CommunityData('my-snmp-agent', 'public') – Ilya Etingof Aug 01 '13 at 13:15
  • @donatello I have added the correct code – user2642036 Aug 03 '13 at 20:30
  • @IlyaEtingof my code does use communitydata. How to check version of pysnmp? do you think that still mgiht be the issue? – user2642036 Aug 03 '13 at 20:31
  • Check the value of pysnmp.__version__ . If it's not defined, that's a really old pysnmp. The latest stable release is 4.2.4. Also, make sure you are using the cmdgen.CommunityData('my-snmp-manager', 'public') syntax. – Ilya Etingof Aug 05 '13 at 09:03

0 Answers0