title: How to get SNMP data using pysnmp?
body: <p>I want to get snmp data by using python pysnmp module. I was using command line to get SNMP data but now I want to read it using pysnmp module. </p>
  
  <p><strong>SNMP command -</strong></p>
  
  <pre><code>snmpwalk -v 1 -c public &lt;ip address&gt;:&lt;port&gt; xyz::pqr
  </code></pre>
  
  <p>I was using command like above. Now I tried something like below -</p>
  
  <pre><code>import netsnmp
  
  def getmac():
      oid = netsnmp.VarList(netsnmp.Varbind('.1.3.6.1.2.1.17.7.1.2.2.1.2'))
      res = netsnmp.snmpgetbulk(oid, Version = 1, DestHost='ip',
                             Community='pub')
      return res
  
  print getmac()
  </code></pre>
  
  <p>I'm facing error - <strong>import netsnmp. No module netsnmp</strong></p>
  
  <p>Anyone can give me suggestion how I can get snmp data from the snmp server with python?</p>