snmpsharp-snmp

#SNMP - GetBulk V2 request is limited to 100 results?


I'm trying to perform the below request and the results should be around 900 variables, not 100. it doesn't matter how many oids I send 1 or 10, I always get no more than 100 variables. what I'm doing wrong?

            var readCommunity = new OctetString("XXXXX");
            var oidsList = new List<string>
            {
"1.3.6.1.2.1.2.2.1.3",
"1.3.6.1.2.1.2.2.1.5",
"1.3.6.1.2.1.2.2.1.6",
"1.3.6.1.2.1.2.2.1.7",
"1.3.6.1.2.1.2.2.1.8",
"1.3.6.1.2.1.2.2.1.2",
"1.3.6.1.2.1.2.2.1.10",
"1.3.6.1.2.1.2.2.1.16",
"1.3.6.1.2.1.2.2.1.14",
"1.3.6.1.2.1.31.1.1.1.6"
            };
            var oids = oidsList.Select(oid => new Variable(new ObjectIdentifier(oid))).ToArray();
            
            ISnmpMessage request= new GetBulkRequestMessage(
                0,
                VersionCode.V2,
                readCommunity,
                0,
                1000,
                oids);

            var response = request.GetResponse(60000, new IPEndPoint(IPAddress.Parse("1.1.1.1"), 161));

Solution

  • You can send a request asking for as many items as you wished, but it is the agent who decides how many to return to you. That's how the standard defines,

    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.

    Reference