snmpget in C#

By | December 17, 2019

SNMP (simple network management protocol) is the way to discover information about remote device or to monitor such device using agentless technique. The agentless approach means that no additional custom spy software is installed on target device. Anyware snmp or WMI are detective features, but usually they are part of operating system. Here is example of agent monitoring tool, the monitoring informer is implemented as bush script scheduled by cron timer.
However returning to snmp. It is possible to write own snmp support on UPD socket level however it is big headache and rather long process especially for snmpv3. Better to use preexisting one with appropriate license such as SNMP++.

Below is example of C# snmpget implementation, which uses SnmpSharpNet library.

The code of shnmsharpget is here..

The result of execution:


C:\Temp>snmpsharpget.exe -v:3 -ap:SHA -aw:snmpv3Password -sn:snmpv3user -pp:AES128 -pw:snmpv3encryptpass -r:192.168.2.15 -o:1.3.6.1.2.1.1.2.0
OID=1.3.6.1.2.1.1.2.0
Type=ObjectId
Value:1.3.6.1.4.1.8072.3.2.10
C:\Temp>snmpsharpget.exe -v:3 -ap:MD5 -aw:snmpv3Password -sn:snmpv3user -r:192.168.2.15 -o:1.3.6.1.2.1.1.2.0
OID=1.3.6.1.2.1.1.2.0
Type=ObjectId
Value:1.3.6.1.4.1.8072.3.2.10

Leave a Reply

Your email address will not be published. Required fields are marked *