让 PHP 站点将 SNMP 信息发送到网络管理应用程序

发布于 2024-08-04 17:29:17 字数 195 浏览 4 评论 0原文

我正在尝试让 PHP 网站通过 SNMP 发送信息。我已经阅读了很多有关 SNMP 的文章,但我仍然有点不知道从哪里开始。

我相信我需要创建一个 MIB,其中包含我的网站将用来发送信息的所有 OID。这是正确的吗?如何以及在哪里定义这些变量 (OID)?有人能指出我正确的方向吗?

我在服务器上使用 FreeBSD。

提前致谢。

I'm trying to make a PHP website send information through SNMP. I've been reading allot about SNMP, but I'm still a bit clueless about where to start.

I believe I need to create an MIB with all the OIDs my website will use to send the info. Is this correct? How and where can I define those variables (OIDs)? Can someone point me in the right direction?

I'm using FreeBSD on the server.

Thanks in advance.

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

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

发布评论

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

评论(3

青萝楚歌 2024-08-11 17:29:17

您想要做的是发送“SNMP 陷阱”。您不一定需要定义 MIB。 MIB 只是将“半人类友好”名称转换为 OID,例如 SNMPv2-MIB::sysContact.0 转换为 .1.3.6.1.2.1.1.4.0 。对于私有应用程序,理论上您可以使用任何您想要的 OID,就像理论上您可以将任何您想要的 IP 地址用于未连接到其他网络的私有网络一样。我不确定是否有首选的“私有”OID 分支。 http://www.paessler.com 有一些很好的信息可以帮助您入门/support/kb/questions/49/ 。看起来 PHP 并不直接支持发送 SNMP 陷阱,但您可以调用“snmptrap”命令。

What you are trying to do is send an "SNMP trap". You don't need to define a MIB necessarily. A MIB just translates a "semi human friendly" name into an OID, such as SNMPv2-MIB::sysContact.0 into .1.3.6.1.2.1.1.4.0 . For a private application, you could theoretically use any OID you want, just as you could theoretically use any IP address you want for a private network that's not connected to others. I am not sure if there is a preferred "private" OID branch. There is some good info to get you started at http://www.paessler.com/support/kb/questions/49/ . It looks like PHP does not directly support sending SNMP traps though, but you could invoke the "snmptrap" command.

爱已欠费 2024-08-11 17:29:17

有几个问题:

  • 要获得自己的顶级标识符,我认为您实际上必须在某个地方请求它(并且可能要付费?),但是您可以使用一个实验范围来测试。 (这不是 php 问题,而是 snmp 问题/功能)

  • 据我所知,该协议假定一个进程侦听与 http 端口完全不同的端口,并且也不使用 TCP,而是使用 UDP 。仅以通常的方式创建一个 php 页面是行不通的。

一个可能的解决方案可能是在 apache(或您正在使用的任何网络服务器)中使用 snmp 模块,该模块允许您在 php 中对响应逻辑进行编程。我的感觉是,您在网络上遇到的大多数 snmp php 内容都不是关于代理部分,而是关于管理器部分。

There are a couple of issues:

  • To get your own top level identifier I think you actually have to request it somewhere (and probably pay money?) however there is an experimental range that you can use to test. (this is not a php issue, it is an snmp issue/feature)

  • As far as I know the protocol assumes a process to listen on a port that is totally different from the http port, and also not using TCP but UDP. Just creating a php page the usual way is not going to work.

A possible solution might be to use a snmp module in apache (or whatever webserver you are using) that allows you to program the response logic in php. My feeling is that most of the snmp php stuff that you encounter on the web is not about the agent part but about the manager part.

峩卟喜欢 2024-08-11 17:29:17

我所知道的是,SNMP 是一种协议,主机向设备发送对特定 OID 值的请求,然后接收响应。

我不确定你是否可以有一个 php 网站来回答这个数据包。

我发现的唯一信息是 PHP 有一个 SNMP 客户端类
PHP SNMP

维基百科为您提供了有关 SNMP 的详细信息
链接文本

但我仍然确信网站不能充当 SNMP 服务器。

What i know is that SNMP is a protocol where an host send request for value of a particular OID to a device and then receive a response.

I'm not sure you can have a php website that answer to this packets.

The only information I have found is that PHP have an SNMP client class
PHP SNMP

And wikipedia gives you detailed info about SNMP
link text

But I'm still sure that a website can't act as an SNMP server.

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