问题
I am developing a C# (targeting full framework 4) windows app. I need that app to write to a few simple counters and more importantly raise (or should that be fire) a few SNMP traps when significant app events occur.
Now most .NET SNMP libraries avalable can do this, so far so good. However I have one significant further requirement; my MIB must add to the PC's own MIB, it must not replace all the good SNMP things that come "out of the bag" with your Windows PC.
This last one seems to be the big deal. All my investigations to date indicate any .NET SNMP solutions out there seem to replace the Windows MIB and the SNMP service(s); they replace the Windows MIB to expose yours. I need to add mine to Windows.
The solution must add its own MIB to the Windows deployment PC, which from what I can tell, means it must (at least in part) provide an unmanaged SNMP extension DLL to extend the standard windows SNMP service.
- Can anyone recommend an approach which extends the standard Winsows SNMP service with extension agents for your own MIB that is a good fit with managed code?
- If I have to do some native Win32 C/C++/Delphi work for the extension agent can anyone recommend an aproach that minimises the amount of unmanged code required?
回答1:
If you want to extend Microsoft's Windows SNMP agent, you have to use unmanaged languages.
There is little possibility to use managed languages, as Microsoft prefers WMI to SNMP and would not make any change to current SNMP agent.
You may consult a commercial .NET SNMP agent vendor to see if they already implement all necessary objects you need. As far as I know, open source/free .NET SNMP vendors do not have that much resource to implement those.
回答2:
I found An assembly called snmpsharpnet wich is very helpful to play with SNMP on the top of .NET.
You will find in this StackOverflow answer an example of one way (high level) to use it.
But look at the documentation. You can use this assembly in two ways :
- Low level to create your own SNMP (V1, V2c, V3) PDUs
- High level, where you just use SNMP
Just try it.
Another way is to use NET-SNMP on the top of Windows. I imagine that you can use your Linux tools on the top of CygWin.
JP
PS : French people can find a first step to this assembly on my company blog
来源:https://stackoverflow.com/questions/5057785/looking-for-an-net-snmp-extension-agent