There are two PySNMP and NetSNMP modules .

PySNMP performance is much lower than NetSNMP, who can explain? And the second question, what does asynchronous and synchronous applications mean in PySNMP?

import time from pysnmp.entity.rfc3413.oneliner import cmdgen def cli(): errorIndication, errorStatus, errorIndex,varBindTable = cmdgen.CommandGenerator().nextCmd(cmdgen.CommunityData('None','1'), cmdgen.UdpTransportTarget(('ats1',161)),(1,3,6,1,2,1,17,7,1,2,2,1,2)) start = time.time() cli() print "!!!Elapsed Time: %.4f" %(time.time() - start) res = !!!Elapsed Time: 15.7561 import netsnmp import time def getmac(): oid = netsnmp.VarList(netsnmp.Varbind('.1.3.6.1.2.1.17.7.1.2.2.1.2')) res = netsnmp.snmpwalk(oid, Version = 1, DestHost='ats1', Community='1') start = time.time() getmac() print "!!!Elapsed Time: %.4f" %(time.time() - start) res = !!!Elapsed Time: 5.6186 

    1 answer 1

    Asynchronous applications are needed, if you need to execute a large number of requests, these requests will be executed in parallel, which is much faster than sequential requests from a synchronous application. But still, asynchronous PySNMP is slower than netsnmp using threads.