问题描述
我正在从事一个涉及SNMP的项目.基本上,我需要在PHP中构造MIB和OID树.
I am working on a project that involves SNMP. Basically I need to construct MIB and OID tree in PHP.
我知道已经有一些程序可以执行此操作,但是我正在尝试实现自己的版本以与我的Web应用程序结合.
I know that there are programs that do this already, but I am trying to implement my own version to incorporate with my webapp.
我所知道的:我熟悉php SNMP功能.我可以使用SNMPWALk来获取OID等.不幸的是,据我所知没有找到所有MIB并将其解析的函数.
What I know: I am familiar with php SNMP function. I can do SNMPWALk to get OIDs and such. Unfortunately there is no function that I know of that finds all MIBs and parses them.
我需要的:首先从远程服务器获取所有MIB文档,然后根据每个文档获取其对象.最后,我的树将具有以下结构:
What I need:Get all MIB docs first from remote server, then based on each docs get their Objects.At the end my tree will have this structure:
+ mib-doc1 |
- obc1
- obj2
+ mib-doc2 |
- obj1
- obj2
- obj3
以此类推...
我也知道:
- 从实际服务器上,我可以获取所有MIB目录:
- 我还可以获得所有MIB文档的列表:
我有2个问题.
- 如何从远程服务器获取所有MIB文档的列表?
- 是否有更简单的方法(具有已知功能)来解析每个MIB以获取对象?
谢谢
推荐答案
如果只需要模块列表,请参见如果,您的管理器支持SNMPv2-MIB :: sysORTable.这当然不能帮助您找到MIB文件,但是会告诉您应该支持什么.
If you just want a list of modules, see if your manager supports SNMPv2-MIB::sysORTable. This does not help you find the MIB files of course, but tells you what is supposed to be supported.
报价规格,sysORTable
为:
这是我获得的标准Linux主机的信息:
Here is what I get for a standard Linux host :
snmptable -M +. -m +ALL -v 2c -c public -Pu -Ci <some ipaddr> SNMPv2-MIB::sysORTable
SNMP table: SNMPv2-MIB::sysORTable
index sysORID sysORDescr sysORUpTime
1 SNMP-MPD-MIB::snmpMPDMIBObjects.3.1.1 The MIB for Message Processing and Dispatching. 0:0:00:00.30
2 SNMP-USER-BASED-SM-MIB::usmMIBCompliance The MIB for Message Processing and Dispatching. 0:0:00:00.30
3 SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance The SNMP Management Architecture MIB. 0:0:00:00.30
4 SNMPv2-MIB::snmpMIB The MIB module for SNMPv2 entities 0:0:00:00.30
5 TCP-MIB::tcpMIB The MIB module for managing TCP implementations 0:0:00:00.30
6 IP-MIB::ip The MIB module for managing IP and ICMP implementations 0:0:00:00.30
7 UDP-MIB::udpMIB The MIB module for managing UDP implementations 0:0:00:00.30
8 SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup View-based Access Control Model for SNMP. 0:0:00:00.30
这篇关于如何使用PHP从远程服务器获取MIB列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!