Implementing an SNMP Reporter (agent) in C# (must run on Mono)?

邮差的信 提交于 2019-12-06 03:18:00

问题


I am attempting to implement some additional statistics gathering in a C# server application - I have about 20 or so variables I'd like to be able to report to network monitoring tools; so I am assuming (hopefully correctly) that SNMP is the correct way to go.

There are however two problems:

  • The application is an open source server that cant include proprietary components, and
  • It needs to run on Mono under *nix environs as well as Windows via .NET.

The "#SNMP" library at http://sharpsnmplib.codeplex.com/ appears to be a promising solution - but there are no samples I can find; and my knowledge of SNMP is lacking.

Does anyone here have any (quick) examples of reporting data via SNMP? (ideally using a library under the LGPL, X/MIT, BSD or Zlib licenses)

Help much appreciated

Edit: The problem appears to be a lack of libraries capable of acting as SNMP servers, if anyone is aware of any - this would probably solve the problem nicely.

Edit #2: Basically I'm looking for a SNMP server library or sample reference implementation.


回答1:


As the author :) I suggest you check out TestAgent sample. It can send out TRAP or INFORM messages to the IP address you specify.

Note that this is a tiny sample, which does not reveal all powers of SNMP.




回答2:


#SNMP source comes with some samples (they're actually tests, but one can have an idea about how it works). Another thing you could try is send your snmp queries calling directly the snmpget executable with the Process class. It's not the best way, but it could work (I've used this kind of approach with another language).



来源:https://stackoverflow.com/questions/1656587/implementing-an-snmp-reporter-agent-in-c-sharp-must-run-on-mono

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!