toddw
toddw

Reputation: 81

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

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"}

Upvotes: 0

Views: 562

Answers (2)

anibal gonzalez
anibal gonzalez

Reputation: 1

I believe I am experiencing the same issue, as I am using WalkAll from the gosnmp library to request multiple OIDs. However, I can get information for some OIDs while others return a timeout error (this behavior can vary; for example, an OID that works might not work if I run the script again). The error I get is a timeout, regardless of whether I set a high timeout value. However, when I try to query the information from the terminal, I can obtain it. I have noticed that the same OID might return information quickly but may show it in parts until the command completes.

Upvotes: 0

toddw
toddw

Reputation: 81

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.

Upvotes: 0

Related Questions