.NET 中的自定义 SNMP 陷阱实现

发布于 2024-08-06 17:48:37 字数 370 浏览 2 评论 0原文

我需要使用 SNMP(在 .NET 中)创建一个监视机制。我认为我们将使用 nsoftware 组件 来处理大部分工作。

看来我们必须使用“陷阱”从代理到服务器进行通信。我们将有许多不同的陷阱和详细说明每个陷阱的各种信息。实施自定义陷阱的最佳方法是什么?也就是说,不仅发送陷阱,而且还将描述陷阱的信息发送到我们的“snmp 管理器”的最佳方法是什么?我认为这是通过“变量绑定”来完成的。要使用“变量绑定”,我们是否需要创建自己的“企业编号”并使用“企业特定”陷阱?我们应该实现自己的自定义 MIB,还是可以通过陷阱发送我们需要的数据(通过变量绑定)?

I need to create a monitoring mechanism using SNMP (in .NET). I think we'll be using an nsoftware component to handle most of the work.

It appears we must use 'traps' to communicate from the agent to the server. We'll have a number of different traps and various information detailing each trap. What is the best way to implement custom traps? That is, what is the best way to not only send a trap, but also send the information describing the trap to our 'snmp manager'? I think this is done through "variable bindings". To use "variable bindings" do we need to create our own "enterprise number" and use an "enterpriseSpecific" trap? Should we implement our own, custom MIBs or can we just send the data we need with the trap (via variable bindings)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

々眼睛长脚气 2024-08-13 17:48:37

除非您想通知 5 个预定义陷阱之一(例如冷启动、热启动):是的,您必须定义一个 enterpriseSpecific 陷阱,并且需要分配对象标识符(以及大量对象标识符)。

参数确实是在变量绑定中传输的;这些结构定义为

VarBind ::=
         SEQUENCE {
           name ObjectName,
           value ObjectSyntax
         }

VarBindList ::= SEQUENCE OF VarBind

ObjectName ::= OBJECT IDENTIFIER
ObjectSyntax ::= CHOICE {
     simple SimpleSyntax,
     application-wide ApplicationSyntax
}

SimpleSyntax ::= CHOICE {
     number INTEGER,
     string OCTET STRING,
     object OBJECT IDENTIFIER,
     empty  NULL
}

ApplicationSyntax ::=  CHOICE {
      address  NetworkAddress,
      counter  Counter,
      gauge    Gauge,
      ticks    TimeTicks,
      arbitrary  Opaque
}

您需要以某种方式告诉您的库名称和值是什么;该库应提供 API 来支持可用作值的各种数据类型。请注意,变量“名称”又是对象标识符。

Unless you want to notify about one of the 5 predefined traps (e.g. cold start, warm start): yes, you will have to define an enterpriseSpecific trap, and you will need to allocate object identifiers (and plenty of them).

Parameters are indeed transmitted in variable bindings; these are structures defined as

VarBind ::=
         SEQUENCE {
           name ObjectName,
           value ObjectSyntax
         }

VarBindList ::= SEQUENCE OF VarBind

ObjectName ::= OBJECT IDENTIFIER
ObjectSyntax ::= CHOICE {
     simple SimpleSyntax,
     application-wide ApplicationSyntax
}

SimpleSyntax ::= CHOICE {
     number INTEGER,
     string OCTET STRING,
     object OBJECT IDENTIFIER,
     empty  NULL
}

ApplicationSyntax ::=  CHOICE {
      address  NetworkAddress,
      counter  Counter,
      gauge    Gauge,
      ticks    TimeTicks,
      arbitrary  Opaque
}

You somehow need to tell your library what the name and the value is; the library should provide API to support the various data types available as values. Notice that the variable "names" are again object identifiers.

巴黎夜雨 2024-08-13 17:48:37

我建议您首先确定代理将数据发送回服务器/监视器的情况数。

然后您需要决定如何区分这些情况(使用不同的 ID 或打包不同的变量绑定)。

现在在一张纸上写下几个数据包并开始在 MIB 文档中编写陷阱定义。

接下来的内容取决于您使用哪个库来实现对话。嗯,软件是一个不错的选择。

顺便说一句,我宁愿发送 TRAP v2 数据包或 INFORM 而不是 TRAP v1。

问候,

莱克斯·李
http://sharpsnmplib.codeplex.com

I suggest you first determine how many cases your agent will send data back to server/monitor.

Then you need to decide how to distinguish those cases (using different ID or packaging different variable bindings).

And now write down several packets on a piece of paper and start to author the trap definition in MIB document.

What's next depends on which library you utilize to implement the conversation. Well, 'nsoftware one is a nice choice.

BTW, I rather send out TRAP v2 packet or INFORM instead of TRAP v1.

Regards,

Lex Li
http://sharpsnmplib.codeplex.com

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文