network-programmingsnmpnet-snmp

Can an snmpget request generate an error?


Is there any context in which an snmpget request with version 2c can generate a response with a non zero error status?

After playing a bit with snmp tools provided by linux Net-SNMP applications, I could not find any such situation. In particular:

So I'm wondering whether this situation (having a positive error status in response of an snmpget request) can occur at all.


Solution

  • The actual GET request processing is documented in RFC 3416 section 4.2.1,

    https://datatracker.ietf.org/doc/html/rfc3416#section-4.2.1

    and there are a few places/cases you must get an error response.

    An actual SNMP agent must implement those error responses so as to be compliant with the standard, but it might add its own logic when needed. You can find a C# agent sample here to see how it handles GET requests and sends back error responses,

    https://github.com/lextudio/sharpsnmplib-samples/blob/master/Samples.Engine/Pipeline/GetMessageHandler.cs