Why would an snmpwalk request made using gosnmp timeout after 29 seconds?

409 Views Asked by At

I am using gosnmp to walk snmp interface tables, 1.3.6.1.2.1.2.2.1 and 1.3.6.1.2.1.31.1.1.1. There is a big variance in the time required to complete this task, I assume this depends on the load on both computers and network congestion. In tests against V1 devices I get a timeout after 29 seconds. Is this because one of the getnext requests that compose the snmpwalk command exceeds the timeout? Is there a way to distinguish calling a busy device and one of many getnext request fails (want a longer timeout) from calling a dead device (want a shorter timeout). After timeout in the middle of snmpwalk, is only the last getnext retried? I assume that gosnmp's snmpwalk wraps the standard snmpwalk. Do the Retries and Timeout fields just map to the -r and -t command line parameters? These are logs from three successive tests against the same device.

{"Elapsed Time":28596.288132,"time":"2021-10-11T18:24:14-04:00","message":"testSnmpWalk succeeded"}

{"error":"request timeout (after 0 retries)","Elapsed Time":29571.202639,"time":"2021-10-11T18:43:37-04:00","message":"testSnmpWalk failed"}

{"Elapsed Time":14645.645597,"time":"2021-10-11T18:44:40-04:00","message":"testSnmpWalk succeeded"}

2

There are 2 best solutions below

2
aadarsh666 On

It can be due to manufacturers implement. You can switch off inline SNMP as a solution . There are many more ways to solve

0
toddw On

My solution was to use exec.Cmd to call net-SNMP. There was some work to pipe and parse the results, but I am pleased with the performance.