SNMP GET-BULK request

Namespace:  SnmpSharpNet
Assembly:  SnmpSharpNet (in SnmpSharpNet.dll) Version: 0.5.2.0 (0.5.2.0)

Syntax

C#
public Dictionary<Oid, AsnType> GetBulk(
	Pdu pdu
)
Visual Basic (Declaration)
Public Function GetBulk ( _
	pdu As Pdu _
) As Dictionary(Of Oid, AsnType)
Visual C++
public:
Dictionary<Oid^, AsnType^>^ GetBulk(
	Pdu^ pdu
)

Parameters

pdu
Type: SnmpSharpNet..::.Pdu
Request Protocol Data Unit

Return Value

Result of the SNMP request in a dictionary format with Oid => AsnType values

Remarks

GetBulk request type is only available with SNMP v2c agents. SNMP v3 also supports the request itself but that version of the protocol is not supported by SimpleSnmp. GetBulk method will return a dictionary of Oid to value mapped values as returned form a single GetBulk request to the agent. You can change how the request itself is made by changing the SimpleSnmp.NonRepeaters and SimpleSnmp.MaxRepetitions values. SimpleSnmp properties are only used when values in the parameter Pdu are set to 0.

Examples

SNMP GET-BULK request:
CopyC#
String snmpAgent = "10.10.10.1";
String snmpCommunity = "private";
SimpleSnmp snmp = new SimpleSnmp(snmpAgent, snmpCommunity);
// Create a request Pdu
Pdu pdu = new Pdu();
pdu.Type = SnmpConstants.GETBULK; // type GETBULK
pdu.VbList.Add("1.3.6.1.2.1.1");
pdu.NonRepeaters = 0;
pdu.MaxRepetitions = 10;
Dictionary<Oid, AsnType> result = snmp.GetBulk(pdu);
if( result == null ) {
  Console.WriteLine("Request failed.");
} else {
  foreach (KeyValuePair<Oid, AsnType> entry in result)
  {
    Console.WriteLine("{0} = {1}: {2}", entry.Key.ToString(), SnmpConstants.GetTypeName(entry.Value.Type),
      entry.Value.ToString());
  }
}
Will return:
CopyC#
1.3.6.1.2.1.1.1.0 = OctetString: "Dual core Intel notebook"
1.3.6.1.2.1.1.2.0 = ObjectId: 1.3.6.1.9.233233.1.1
1.3.6.1.2.1.1.3.0 = TimeTicks: 0d 0h 0m 1s 420ms
1.3.6.1.2.1.1.4.0 = OctetString: "msinadinovic@users.sourceforge.net"
1.3.6.1.2.1.1.5.0 = OctetString: "milans-nbook"
1.3.6.1.2.1.1.6.0 = OctetString: "Developer home"
1.3.6.1.2.1.1.8.0 = TimeTicks: 0d 0h 0m 0s 10ms

See Also