Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3496442
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:14:56+00:00 2026-05-18T12:14:56+00:00

I am using one of the examples for GetNext operation for an SNMPWalk of

  • 0

I am using one of the examples for GetNext operation for an SNMPWalk of the tree. I am using the asynchronous variant to collect the OIDs –

# GETNEXT Command Generator
from pysnmp.entity.rfc3413.oneliner import cmdgen
from pysnmp.proto import rfc1902

# ( ( authData, transportTarget, varNames ), ... )
targets = (
    # 1-st target (SNMPv1)
    ( cmdgen.CommunityData('test-agent-1', 'public'),
      cmdgen.UdpTransportTarget(('localhost', 161)),
      (rfc1902.ObjectName((1,3,6,1,2,1)), rfc1902.ObjectName((1,3,6,1,3,1)))),
    # 2-nd target (SNMPv2c)
    ( cmdgen.CommunityData('test-agent-2', 'public', 1),
      cmdgen.UdpTransportTarget(('localhost', 161)),
      (rfc1902.ObjectName((1,3,6,1,2,1,2)),) ),
    )

def cbFun(
    sendRequestHandle, errorIndication, errorStatus, errorIndex,
    varBindTable, (varBindHead, authData, transportTarget)
    ):
    if errorIndication:
        print 'SNMP engine error', errorIndication
        return 1
    if errorStatus:
        print 'SNMP error %s at %s' % (errorStatus, errorIndex)
        return 1
    varBindTableRow = varBindTable[-1]
    for idx in range(len(varBindTableRow)):
        name, val = varBindTableRow[idx]
        if val is not None and varBindHead[idx].isPrefixOf(name):
            # still in table
            break
    else:
        print 'went out of table at %s' % (name, )
        return

    for varBindRow in varBindTable:
        for oid, val in varBindRow:
            if val is None:
                print oid.prettyPrint()
            else:
                print '%s = %s' % (oid.prettyPrint(), val.prettyPrint())

    return 1 # continue table retrieval

cmdGen  = cmdgen.CommandGenerator()

for authData, transportTarget, varNames in targets:
    cmdGen.asyncNextCmd(
        authData, transportTarget, varNames,
        # User-space callback function and its context
        (cbFun, (varNames, authData, transportTarget))
        )

cmdGen.snmpEngine.transportDispatcher.runDispatcher()

I get the OIDs I need; however when it goes out the table and returns from cbFun, the Dispatcher in the last line throws an error, which I am not able to resolve, the output looks something like –

... (some 1.3.6.1.2.1.* stuff)
1.3.6.1.2.1.2.2.1.22.1 = 0.0
1.3.6.1.2.1.2.2.1.22.2 = 0.0
1.3.6.1.2.1.2.2.1.22.3 = 0.0
went out of table at (1, 3, 6, 1, 2, 1, 3, 1, 1, 1, 2, 1, 212, 201, 49, 186)
Traceback (most recent call last):
  File "asyncsnmpwalk.py", line 55, in <module>
    cmdGen.snmpEngine.transportDispatcher.runDispatcher()
  File "/var/lib/python-support/python2.5/pysnmp/v4/carrier/asynsock/dispatch.py", line 61, in runDispatcher
    self.handleTimerTick(time())
  File "/var/lib/python-support/python2.5/pysnmp/v4/carrier/base.py", line 81, in handleTimerTick
    self.__timerCbFun(timeNow)
  File "/var/lib/python-support/python2.5/pysnmp/v4/entity/engine.py", line 60, in __receiveTimerTickCbFun
    self.msgAndPduDsp.receiveTimerTick(self, timeNow)
  File "/var/lib/python-support/python2.5/pysnmp/v4/proto/rfc3412.py", line 491, in receiveTimerTick
    self.__cacheExpire(snmpEngine, self.__expireRequest)
  File "/var/lib/python-support/python2.5/pysnmp/v4/proto/rfc3412.py", line 56, in __cacheExpire
    if cbFun(snmpEngine, cachedParams):
  File "/var/lib/python-support/python2.5/pysnmp/v4/proto/rfc3412.py", line 486, in __expireRequest
    cbCtx
  File "/var/lib/python-support/python2.5/pysnmp/v4/entity/rfc3413/cmdgen.py", line 77, in processResponsePdu
    (self.processResponsePdu, (cbFun, cbCtx))
  File "/var/lib/python-support/python2.5/pysnmp/v4/entity/rfc3413/cmdgen.py", line 164, in _sendPdu
    (processResponsePdu, float(timeout)/100 + time.time(), cbCtx)
  File "/var/lib/python-support/python2.5/pysnmp/v4/proto/rfc3412.py", line 161, in sendPdu
    sendPduHandle
  File "/var/lib/python-support/python2.5/pysnmp/v4/proto/mpmod/rfc2576.py", line 89, in prepareOutgoingMessage
    scopedPDU
  File "/var/lib/python-support/python2.5/pysnmp/v4/proto/secmod/rfc2576.py", line 78, in generateRequestMsg
    errorIndication = 'unknownCommunityName'
pysnmp.proto.error.StatusInformation: {'errorIndication': 'unknownCommunityName'}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:14:56+00:00Added an answer on May 18, 2026 at 12:14 pm

    changing CommunityData string did the trick (I don’t know why)

    BEFORE

    cmdgen.CommunityData('test-agent-1', 'public'), 
    

    AFTER

    cmdgen.CommunityData('test-agent', 'public'),
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using one of the examples from a previous question I have: $(window).keypress(function(event) { if
Ok, so I am using the facebox plugin. One of the examples given is
I was reading some examples on symbols in ruby, and one example was using
I'm using a Carousel example from this website. For one single carousel on the
How does one go about catching exceptions from using controls in markup? For example,
From this example http://www.senchafiddle.com/#dPZn0 This displays a first panel, then a second one... using
I'm using one of the force layout examples ( http://bl.ocks.org/1153292 ) to show a
I'm using one of the examples for the v4 compatibility app. I've noticed that
I have implemented simple com.sun.net.httpserver.HttpServer application using one of examples in the internet. Server
So I am using one of the imgur api examples for uploading an image

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.