Reputation: 869
I need to ask 4000 hosts with simple snmpget query. I used netsnmp with threads and pynetsnmp with twisted and it works pretty fast (less 1 minute). I tried to use pysnmp with AsyncCommandGenerator and pysnmp with twisted (i've fixed that example with one instance of SnmpEngine)
and it took more than 10 minutes. Am i doing something wrong? Should the pysnmp be so slow?
Upvotes: 2
Views: 3188
Reputation: 276
EDIT: pastebin example added
Please post your current version of the script.
In the code you refer to you may try to optimize out some of:
addV1System()
addTargetParams()
addSocketTransport()
calls whenever you call them more then once with the same arguments.
In other words, if among the 4000 hosts you query the only difference is host's address, then the only call you need to repeat is addTargetAddr(). Otherwise you re-configure SNMP engine on every request.
To better estimate pysnmp performance you consider running the following example configured with the 4000 hosts you with to query.
If you would never need SNMPv3 and performance is your priority, you may wish to employ pysnmp's low-level API.
But in any case you would never come close to C implementation in terms of performance. ;-)
Upvotes: 3