用 C# 实现 SNMP 报告器(代理)(必须在 Mono 上运行)?
我正在尝试在 C# 服务器应用程序中实现一些额外的统计信息收集 - 我有大约 20 个左右的变量,我希望能够向网络监控工具报告;所以我假设(希望是正确的)SNMP 是正确的方法。
然而存在两个问题:
- 该应用程序是一个开源服务器,不能包含专有组件,并且
- 它需要在 *nix 环境下的 Mono 上运行以及通过 .NET 在 Windows 上运行。
http://sharpsnmplib.codeplex.com/ 上的“#SNMP”库似乎是一个有前途的解决方案 -但我找不到样品;而且我对SNMP的了解也很缺乏。
这里有人有通过 SNMP 报告数据的(快速)示例吗? (最好使用 LGPL、X/MIT、BSD 或 Zlib 许可证下的库)
非常感谢
编辑: 问题似乎是缺乏能够充当 SNMP 服务器的库,如果有人知道的话 - 这可能会很好地解决问题。
编辑#2: 基本上我正在寻找 SNMP 服务器库或示例参考实现。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
作为作者:) 我建议您查看 TestAgent 示例。它可以向您指定的 IP 地址发送 TRAP 或 INFORM 消息。
请注意,这是一个很小的示例,并未揭示 SNMP 的所有功能。
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.
#SNMP 源附带了一些示例(它们实际上是测试,但人们可以了解它是如何工作的)。
您可以尝试的另一件事是使用 进程 类。这不是最好的方法,但它可以工作(我已经在另一种语言中使用了这种方法)。
#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).