Apparently not everybody is as interested in the background workings of the SNMP protocol as I am. For this reason I have created a very simple to use utility class that will allow you to make requests and collect replies without worrying too much about how it’s all done.
For that reason I have created SimpleSnmp class. It makes common SNMP version 1 and 2c operations simple. Version 3 is not included because there is a security aspect that, if simplified too much, will no longer be secure.
To dive straight in, here is a SNMP-Get request example:
On my laptop, result looks like this:
1.3.6.1.2.1.1.1.0: OctetString "Dual core Intel notebook"
Obviously, you can request multiple values in a single request just by adding them to the SimpleSnmp.Get() OID string array.
Methods are also available for GetNext:
GetBulk:
Set:
and Walk:
SimpleSnmp.Walk uses GetBulk with SNMP version 2c. If SNMP version 1 is selected, GetNext operation is used and is considerably slower.
To control how GetBulk and SNMP version 2 walk performs, you can set SimpleSnmp.NonRepeaters and SimpleSnmp.MaxRepetitions values to adjust how GetBulk calls are made.
Prior to using the class, you can check the status of the SimpleSnmp.Valid property to verify class is in correctly initialized. This property will validate that agent name was correctly resolved to an IP address and that community name is set.
Original: https://www.cnblogs.com/EasyData/archive/2010/01/23/1654929.html
Author: 迷你软件
Title: Simple SNMP with SimpleSnmp
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/598730/
转载文章受原作者版权保护。转载请注明原作者出处!