用于跨不同型号设备使用 SNMP 查询数据的 Cisco IOS OID 的稳定性如何?
我正在使用 SNMP 从 cisco 交换机查询大量信息。 例如,我通过在 .1.3.6.1.4.1.9.9.23 上执行 snmpwalk 来提取使用 CDP 检测到的邻居的信息
我可以在不同的 cisco 型号中使用此 OID 吗? 我应该注意哪些陷阱? 对我来说,我对使用数字 OID 有点不安 - 似乎我应该使用 MIB 数据库或其他东西并使用命名的 OID,以获得跨设备兼容性,但也许我只是想象需要为了那个原因。
I'm querying a bunch of information from cisco switches using SNMP. For instance, I'm pulling information on neighbors detected using CDP by doing an snmpwalk on .1.3.6.1.4.1.9.9.23
Can I use this OID across different cisco models? What pitfalls should I be aware of? To me, I'm a little uneasy about using numeric OIDs - it seems like I should be using a MIB database or something and using the named OIDs, in order to gain cross-device compatibility, but perhaps I'm just imagining the need for that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
如果不可能,则可以使用 OID,因为根据 SNMP MIB 准则,它们不应更改。 除非设备本身发生变化,但无论如何都需要新的 MIB,而新的 MIB 不能重用旧的 OID。
杰..
If that is not possible, then it is okay to use OIDs as they should not change per the SNMP MIB guidelines. Unless the device itself changes but that requires a new MIB anyway which can't reuse old OIDs.
Jay..
这是非常一致的。
监控工具依赖于一致性,Cicso 生成的 MIB 很少更改旧值,通常只实施新值。
查看 Cisco OID查找工具。
请注意,它不会询问您查找的产品是什么。
-MW
It is very consistent.
Monitoring tools depend on the consistency and the MIBs produced by Cicso rarely change old values and usually only implement new ones.
Check out the Cisco OID look up tool.
Notice how it doesn't ask you what product the look up is for.
-mw
OID 可能随硬件的不同而变化,也可能随同一硬件的固件版本的变化而变化,因为随着时间的推移,管理功能的架构可能会发生变化并需要新的 MIB。 值得检查一下您打算使用的任何 OID 是否位于已弃用的 MIB 中,或者在应用程序的生命周期中是否已弃用,因为这不仅表明该 MIB 有一天可能不受支持,而且还可能会得到改进、更丰富的数据或访问数据。 在广泛部署之前,作为固件更新例行测试的一部分,针对示例升级设备测试管理应用程序也是一种很好的做法。
由于 MIB 被弃用而导致 OID 更改的示例位于
http://www.cisco.com/en/US/tech/tk648/tk362/technologies_configuration_example09186a0080094aa6.shtml
The OIDs can vary with hardware but also with firmware version for the same hardware as, over time, the architecture of the management functions can change and require new MIBs. It is worth checking whether any of the OIDs you intend to use are in deprecated MIBs, or become so in the life of the application, as this indicates not only that the MIB could one day be unsupported but also that there is likely to be improved, richer data or access to data. It is also good practice to test management apps against a sample upgraded device as part of the routine testing of firmware updates before widespread deployment.
An example of a change of OID due to a MIB being deprecated is at
http://www.cisco.com/en/US/tech/tk648/tk362/technologies_configuration_example09186a0080094aa6.shtml
MIB 一旦发布,就不会转移到新的 OID。 这样做会破坏网络管理工具并引发支持电话,这是没人愿意的。 为了继续您的示例,CDP MIB 已发布在 Cisco 的 SNMP 对象导航器。
对于一般代码清洁度,最好在一个中心位置定义 OID,特别是因为您不想为每个对象复制完整的 OID您需要访问的单个表。
最需要注意的地方是Cisco最近收购的产品中的一个独特的MIB。 如果没有其他办法将 OID 移至自己的企业 OID 空间,OID 将会发生变化,但 MIB 也可能会发生变化以符合 Cisco 的 SNMP 实践。
Once a MIB has been published it won't move to a new OID. Doing so would break network management tools and cause support calls, which nobody wants. To continue your example, the CDP MIB has been published at Cisco's SNMP Object Navigator.
For general code cleanliness it would be good to define the OIDs in a central place, especially since you don't want to duplicate the full OID for every single table you need to access.
The place you need to be most careful is a unique MIB in a product which Cisco recently acquired. The OID will change, if nothing else to move it into their own Enterprise OID space, but the MIB may also change to conform to Cisco's SNMP practices.
在某些情况下,使用名称而不是数字表示可能会严重影响性能,因为需要读取和解析 MIB 文件以获得较低级别库所需的 OID 的数字表示。
例如,假设您使用程序每分钟收集一些内容,那么一遍又一遍地加载 MIB 的效率非常低。
正如其他人所说,一旦发布,数字映射的名称就永远不会改变,因此将内容硬编码到程序中并不是真正的问题。
如果您有权访问命令行 SNMP 工具,请查看 'snmptranslate ' 这是一个从文本到数字 OID 来回切换的好工具。
In some cases, using the names instead of the numerical representations can be a serious performance hit due to the need to read and parse the MIB files to get the numerical representations of the OIDs that the lower level libraries need.
For instance, say your using a program to collect something every minute, then loading the MIBs over and over is very inefficient.
As stated by others, once published, the name to numerical mapping will never change, so the fact that you're hard-coding stuff into your programs is not really a problem.
If you have access to command line SNMP tools, check out 'snmptranslate' for a nice tool to get back and forth from text to numerical OIDs.
我认为这是一个常见的误解(关于每次解析名称时 MIB 重新加载)。
大多数 SNMP API(例如 AdventNet、CMU)在启动时加载 MIBS,此后每次您要求从名称到 oid 的“翻译”时都不会加载 MIB 的“开销”,反之亦然。 更重要的是,其中一些会缓存结果,此时,名称查找和直接编码 OID 之间没有区别。
这有点类似于指定“IP 地址”与“主机名”。
I think that is a common misconception (about MIB reload each time you resolve a name).
Most of the SNMP APIs (such as AdventNet, CMU) load the MIBS at startup and after that there is no 'overhead' of loading MIBs everytime you ask for a 'translation' from name to oid and vice versa. What's more, some of them cache the results and at that point, there is no difference between name lookups and directly coding the OID.
This is a bit similar to specifying an "IP Address" versus a 'hostname'.