title: How to make a single GETNEXT query in PySNMP
body: <p>I'm trying to make a simple snmp GETNEXT query to retrieve <strong>only</strong> the next item of given OID in tree hierarchy.</p>
  
  <p>For example, what I want is:</p>
  
  <p>When i make a <strong>GETNEXT</strong> request with OID <strong><em>1.3.6.1.2.1.1</em></strong> (iso.org.dod.internet.mgmt.mib-2.system)</p>
  
  <p>I expect to get a <strong>single</strong> response including OID <strong><em>1.3.6.1.2.1.1.1.0</em></strong> (iso.org.dod.internet.mgmt.mib-2.system.sysDescr.0) with its corresponding value.</p>
  
  <p>The fact is:</p>
  
  <p>Insted of retrieving single next value, PySNMP performs an SNMP walk under <strong>1.3.6.1.2.1.1</strong> and retrieves all subItems.</p>
  
  <p><strong>How can i change this behaviour and make it to just return single next value instead of performing an snmpwalk?</strong></p>
  
  <p>I use the below code which is taken from PySNMP's documentation.</p>
  
  <pre><code># GETNEXT Command Generator
  from pysnmp.entity.rfc3413.oneliner import cmdgen
  
  errorIndication, errorStatus, errorIndex, \
                   varBindTable = cmdgen.CommandGenerator().nextCmd(
      cmdgen.CommunityData('test-agent', 'public'),
      cmdgen.UdpTransportTarget(('localhost', 161)),
      (1,3,6,1,2,1,1)
      )
  
  if errorIndication:
      print errorIndication
  else:
      if errorStatus:
          print '%s at %s\n' % (
              errorStatus.prettyPrint(),
              errorIndex and varBindTable[-1][int(errorIndex)-1] or '?'
              )
      else:
          for varBindTableRow in varBindTable:
              for name, val in varBindTableRow:
                  print '%s = %s' % (name.prettyPrint(), val.prettyPrint())
  </code></pre>