python - pysnmp nextcmd stops on timeout -
i trying perform snmp walk on networking devices.
on netwroking devices succeed go through devices oids , on networking devices don't succeed go through devices oids.
here code:
cmdgen = cmdgen.asyncommandgenerator() cmdgen.asyncnextcmd( cmdgen.communitydata('public', mpmodel=0), cmdgen.udptransporttarget(('ip', 161),timeout=timeout,retries=retries), ((1,3),), (cbfun_walk, none)) cmdgen.snmpengine.transportdispatcher.rundispatcher() the problem asynccommandgenerator gets timeout on certaion oid , exists out of thread.
as can see thread reaches oid, gets timeout error, , quits thread.
know how continue snmpwalk if timed out oid reached.
if asynccommandgenerator reaches timed out oid, should continue walk , rest of oids.
how achieve this?
logically speaking, can't skip "next" oid on request timeout, not know next oid then. can see 2 workarounds here:
- repeat getnext request same oid long takes response. increasing request timeout , retry count. proper snmp responder should respond valid requests.
- try guess "next" oid past 1 can't response for. mib-dependent , in many cases may require non-trivial fuzziness. once somehow picked next oid, re-start original code guessed oid. "skip" problem oid (or many of them @ once if guess not perfect). in case of timeout may consider changing next oid selection logic -- chances still hitting same timing out oid.
Comments
Post a Comment