SNMP GETBULK Issue: Only could get parts records(Such as 59 records, but there are more than 100 records)

snmp mib groups
snmp integer size
snmp object identifier syntax
snmp mib format
snmp iftable
snmp tree
snmp index
snmp oid list

I would like to get the interface information for the router by snmp GETBULK, but when I use it, only parts of the record were returned.

The code is below:

public static void main(String[] args) throws IOException, InterruptedException {
    Snmp snmp = new Snmp(new DefaultUdpTransportMapping());
    snmp.listen();

    CommunityTarget target = new CommunityTarget();
    target.setCommunity(new OctetString("public"));
    target.setVersion(SnmpConstants.version2c);
    target.setAddress(new UdpAddress("127.0.0.1/161"));
    target.setTimeout(3000);    //3s
    target.setRetries(1);

    PDU pdu = new PDU();
    pdu.setType(PDU.GETBULK);
    pdu.setMaxRepetitions(200); 
    pdu.setNonRepeaters(0);
    pdu.add(new VariableBinding(new OID("1.3.6.1.2.1.31.1.1.1.1"))); 

    ResponseEvent responseEvent = snmp.send(pdu, target);
    PDU response = responseEvent.getResponse();

    if (response == null) {
        System.out.println("TimeOut...");
    } 
    else 
    {
        if (response.getErrorStatus() == PDU.noError) 
        {
            Vector<? extends VariableBinding> vbs = response.getVariableBindings();
            for (VariableBinding vb : vbs) {
                System.out.println(vb + " ," + vb.getVariable().getSyntaxString());
            }
        } 
        else 
        {
            System.out.println("Error:" + response.getErrorStatusText());
        }
    }
}

After executing it, there are 59 records be returned, but if I use GETNEXT to get them, there are about 197 records be returned.

Any ideas?

Hope anyone could help me, thanks in advance.

How big are your responses? Remember - a getbulk response has to fit in a single UDP packet. That's an absolute limit of 65,535 bytes - or if you've got MTU limitations potentially as small as 1,500 bytes.

snmp4j - unable to get full records with getBulk, as i have found earlier: SNMP GETBULK Issue: Only could get parts records(​Such as 59 records, but there are more than 100 records). UPDATE using subqueries - Updates more than the needed records Can't have more than 100 records in CloudKit Fast Update database with more than 10 million records

I would just like to point out that the original poster had the solution : use GETNEXT instead of GETBULK and you will get all of the records. GETBULK will only work for you if your returns are within the size PP. specified.

SNMP GETBULK Issue: Only could get parts records , SNMP GETBULK Issue: Only could get parts records(Such as 59 records, but there are more than 100 records) 1.snmp4j - SNMP GETBULK  mid.snmp.use_getbulk Specifies whether to use GETBULK to receive a large amount of data in batches. This can be used to configure an individual MID Server. Type: true | false; Default value: True; GETBULK can also be set at the probe level or globally for all MID servers. Settings are listed in the order of precedence:

This is expected behaviour, and can happen for a few reasons.

Quoting RFC 3416 §4.2.3 "The GetBulkRequest-PDU" (emphasis mine):

[..] The receiving SNMP entity produces a Response-PDU with up to the total number of requested variable bindings communicated by the request.

[..] While the maximum number of variable bindings in the Response-PDU is bounded by N + (M * R), the response may be generated with a lesser number of variable bindings (possibly zero) for either of three reasons.

  1. If the size of the message encapsulating the Response-PDU containing the requested number of variable bindings would be greater than either a local constraint or the maximum message size of the originator, then the response is generated with a lesser number of variable bindings. This lesser number is the ordered set of variable bindings with some of the variable bindings at the end of the set removed, such that the size of the message encapsulating the Response-PDU is approximately equal to but no greater than either a local constraint or the maximum message size of the originator. Note that the number of variable bindings removed has no relationship to the values of N, M, or R.

  2. The response may also be generated with a lesser number of variable bindings if for some value of iteration i, such that i is greater than zero and less than or equal to M, that all of the generated variable bindings have the value field set to "endOfMibView". In this case, the variable bindings may be truncated after the (N + (i * R))-th variable binding.

  3. In the event that the processing of a request with many repetitions requires a significantly greater amount of processing time than a normal request, then a command responder application may terminate the request with less than the full number of repetitions, providing at least one repetition is completed.

[..]

In your case, you're most likely exceeding the maximum message size.

If you get fewer objects than you wanted, you can just do another GetBulk request starting where you left off. (This is the same as how you handle TCP/IP sockets in C code — you have to keep read()ing in turn until you have everything you want.)

For example, implementations such as Net-SNMP's snmptable (a table walker that can be instructed to use GetBulk) will do this until the end of the table has been reached.

21 Network Management and SNMP, SNMP GETBULK Issue: Only could get parts records(Such as 59 records, but there are more than 100 records). like to get the interface information for the router by snmp GETBULK, but when I use it, only parts of the record were returned. Patented Active-Active capabilities enhance performance when there is more than one array configured. Each of the dual controllers has access to all the backplane SAS bays and can back up the other controller if there were to be a problem with the other controller.

RFC 3512, Attributes may, however, be organized into records, sets and tables. to make SNMP queries, such as the snmpget and snmpwalk commands of the Net-SNMP Even for read-only SNMP, however, security is an important issue; see 21.11 GetBulk has considerable potential to return more data than there is room for,  Start studying Networking Main Set Ch. 1-7. Learn vocabulary, terms, and more with flashcards, games, and other study tools.

[PDF] System Administrator Reference Manual, SNMP GETBULK Issue: Only could get parts records(Such as 59 records, but there are more than 100 records). How big are your responses? Remember - a  It can be used over most distances, provided there is a line of sight. The disadvantage is that any break in the line of sight breaks communication You wish to use nmap to scan one of your servers, whose IP address is 192.168.1.16.

ENA processes and utilities – Entuity, This growth can be seen in terms of: Scale - Networks have more network elements No longer can it be assumed that a configuration will be specified once and then For this reason, reliance on transactional integrity only at the SNMP protocol supports such time indexing and can record the user that made the change,  A. Memory cards normally hold more memory than smart cards B. Smart cards provide a two-factor authentication whereas memory cards don't C. Memory cards have no processing power D. Only smart cards can be used for ATM cards

Comments
  • So what's the solution? How do you get back more data?
  • @darrickc break down your request into several separate requests. Or limit the maximum number of responses to your getbulk request.
  • This is only partially helpful. It is true that there is an upper bound on the amount of data returned, but if you're using GetBulk you're probably doing so for a reason: it's generally better to continue performing GetBulk requests for your remaining objects (as many as needed!) rather than drop your request down to just one object at a time (efficient!).
  • Indeed, a GetNext is also subject to these constraints if you plug enough varbinds into the request!