SNMP v2c and v3 EndOfMibView, NoSuchInstance and NoSuchObject types

SNMP v2 introduced a concept of MIB status notification encoded in the VbList as a value that notifies the caller when there is an issue with the request or if request has reached the end of available data.

This is where EndOfMibView, NoSuchInstance and NoSuchObject come in. EndOfMibView tells caller that there is no more data to “walk” (using either GET-NEXT or GET-BULK packets), NoSuchInstance tells the caller that requested instance of the object does not exist (for example, asking for interface speed – 1.3.6.1.2.1.2.2.1.5 for interface instance 200 on an agent that only has interfaces up to instance 100 will result in this error), and EndOfMibView signifying the end of the data in the requested view.

To check for these notifications, you should evaluate each value returned by the agent, first for the notification and second for the value it should contain.

For example, after a request completed using SNMP v2c or 3, you could do the following:

SnmpV2Packet pkt = GetData();
foreach( Vb v in pkt.Pdu.VbList ) {
  if( v.Value.Type == SnmpConstants.SMI_ENDOFMIBVIEW ) {
    // end of mib reached
    return;
  } else {
   // process Vb value
  }
}