Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Define MIB and send SNMP trap under .net

I have developed a special application for a company under .net in C# and it is used for years. Now it is developed on, one of the main new features I have to implement is to integrate it with another software by sending SNMP traps to it in some alert situations.

I am an experienced developer but I have never used SNMP. I googled the whole day but getting more and more confused about this topic. I don't have a clear 'starting point'. I understand the basics of SNMP but I don't know where and how to begin implementation.

I have the data I should send via SNMP trap, it has some 10 properties, some dates, numbers and strings. I should create MIB definition(s) on this properties. Later I should implement a feature in my application that sends SNMP traps based on this MIBs.

The project is developed under .net 4 in c#. I found this library that seems promising: http://sharpsnmplib.codeplex.com/ It has some sample about sending SNMP traps.

My problem is: where to begin? How can I define MIB files? I know they're some text files that must be compiled, but have not find any MIB editors and help on this topic.

Any help is appreciated!

Thanks!

like image 820
Tom Avatar asked Jan 27 '12 22:01

Tom


1 Answers

I am not an expert, but have experience of being in the same spot as you were and finally found something enough for my project.

I used this codeplex library you referred before and found to be quite good. Here are some pointers for you to go through the http://sharpsnmplib.codeplex.com/.

  • As far as my understanding goes an MIB file is required when you need to do a snmpget and snmpset
    • This is sort of you informing the server and the server coming back to your client asking for more detailed info, and may be required if you require extensive info to be shared about your app
  • If all you need is just traps, you can do this
    • Run the snmpd.exe which will act like the snmp server receiving traps sent from your application.
    • Write a program similar the snmptrapd.exe and send your traps.

The link http://www.net-snmp.org/wiki/index.php/TUT:snmptrap is a good one for getting a basic understanding and get more library info.

Edit: Just missed one point. You'll need MIB file if you use get and set for snmp. If all you have is traps, you may not need it.

like image 185
Muthu Avatar answered Nov 05 '22 21:11

Muthu