gpt4 book ai didi

java - 无需等待超时即可检查设备是否有 snmp 对象?

转载 作者:行者123 更新时间:2023-11-30 03:32:31 25 4
gpt4 key购买 nike

我正在使用 snmp4j 收集 POE(以太网供电)端口上的功耗。但有些设备不支持POE。当我去询问这些设备的功耗时,它们最终超时了。

等待超时会导致网页上的信息显示出现不必要的延迟。

我认为没有一个普遍可用的对象可以告诉您设备是否支持 POE,所以我想知道是否有一种方法可以询问设备是否存在对象,而无需实际请求该对象,然后等待超时。

最佳答案

1) 某些设备将支持SNMPv2-MIB::sysORTable;也许您可以检索它,并在尝试检索 POE 数据之前查看是否存在带有 POE 的 MIB(假设这里是 POE 检索速度慢,而不是 SNMP 往返!)

引用How can I get MIBs list from a remote server by using PHP? sysORTable 是:

"The (conceptual) table listing the capabilities of the local SNMP application acting as a command responder with respect to various MIB modules. SNMP entities having dynamically-configurable support of MIB modules will have a dynamically-varying number of conceptual rows."

以下是我对标准 Linux 主机的了解:

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
// SNIP
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

2) 或者,您可以使用当前的方法,除了更短(非默认)的 SNMP 检索超时吗?

关于java - 无需等待超时即可检查设备是否有 snmp 对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28679573/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com