SNMP WALK operation

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

Syntax

         
 C#  Visual Basic  Visual C++ 
public Dictionary<Oid, AsnType> Walk(
	SnmpVersion version,
	string rootOid
)
Public Function Walk ( _
	version As SnmpVersion, _
	rootOid As String _
) As Dictionary(Of Oid, AsnType)
public:
Dictionary<Oid^, AsnType^>^ Walk(
	SnmpVersion version, 
	String^ rootOid
)

Parameters

version
SnmpVersion
SNMP protocol version. Acceptable values are SnmpVersion.Ver1 and SnmpVersion.Ver2
rootOid
String
OID to start WALK operation from. Only child OIDs of the rootOid will be retrieved and returned

Return Value

Oid => AsnType value mappings on success, empty dictionary if no data was found or null on error

Remarks

When using SNMP version 1, walk is performed using GET-NEXT calls. When using SNMP version 2, walk is performed using GET-BULK calls.

Examples

Example SNMP walk operation using SNMP version 1:
CopyC#
String snmpAgent = "10.10.10.1";
String snmpCommunity = "private";
SimpleSnmp snmp = new SimpleSnmp(snmpAgent, snmpCommunity);
Dictionary<Oid, AsnType> result = snmp.Walk(SnmpVersion.Ver1, "1.3.6.1.2.1.1");
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
To use SNMP version 2, change snmp.Set() method call first parameter to SnmpVersion.Ver2.

See Also