SNMP查询IP侦听端口

SNMP查询IP侦听端口,snmp,nagios,Snmp,Nagios,我想查询远程主机的侦听端口 使用snmpwalk可以显示以下内容: # snmpwalk -c public -v2c somehost TCP-MIB::tcpListenerProcess.ipv4 TCP-MIB::tcpListenerProcess.ipv4."0.0.0.0".13 = Gauge32: 0 TCP-MIB::tcpListenerProcess.ipv4."0.0.0.0".22 = Gauge32: 0 TCP-MIB::tcpListenerProcess.ip

我想查询远程主机的侦听端口

使用snmpwalk可以显示以下内容:

# snmpwalk -c public -v2c somehost TCP-MIB::tcpListenerProcess.ipv4
TCP-MIB::tcpListenerProcess.ipv4."0.0.0.0".13 = Gauge32: 0
TCP-MIB::tcpListenerProcess.ipv4."0.0.0.0".22 = Gauge32: 0
TCP-MIB::tcpListenerProcess.ipv4."0.0.0.0".111 = Gauge32: 0
...
但我无法查询特定端口(就像监控软件nagios所做的那样):

我试图放置一些特殊的外壳保护,但没有成功:

# snmpget -c public -v2c localhost 'TCP-MIB::tcpListenerProcess.ipv4."0.0.0.0".111'
TCP-MIB::tcpListenerProcess.ipv4."0.0.0.0".111 = No Such Instance currently exists at 

# snmpget -c public -v2c localhost 'TCP-MIB::tcpListenerProcess.ipv4.\"0.0.0.0\".111'
TCP-MIB::tcpListenerProcess.ipv4.\"0.0.0.0\".111: Unknown Object Identifier (Index out of range: \"0 (tcpListenerLocalAddress))

任何人都可以解释一下这一点,并且可能有关于如何正确查询此OID的提示吗?

请注意:这是Debian上的snmp(5.7.2~dfsg-8.1+b1)和snmpd(5.7.2~dfsg-8.1+b1)软件包在TCP-MIB::tcpListenerProcess.ipv4.1.3.6.1.2.1.6.20.1.4.1.4.0.0.0.13=Gauge32:0.1.3.6.1.2.6.20.1.4.1.1.4.4.0.0.22=Gauge32:0.1.3.1.1.2.1.6.0.0.37=Gauge32:so上添加snmpwalk-c public-v2c-somehost的输出。。。。111是当前snmpwalk的插座吗?第二次是37而不是111?无论如何,你应该在Nagios上使用数字OID,但我认为这不是你的问题。我的帖子是假的。我只是发布了snmpwalk输出的前三行,没有验证它是否与上述内容匹配。认为“37”是“111”;除此之外,你的建议当然是有效的。我试图通过使用MIB表示来“聪明”,但显然netsnmp在解析该表示时仍然存在问题。谢谢你的支持。
# snmpget -c public -v2c localhost 'TCP-MIB::tcpListenerProcess.ipv4."0.0.0.0".111'
TCP-MIB::tcpListenerProcess.ipv4."0.0.0.0".111 = No Such Instance currently exists at 

# snmpget -c public -v2c localhost 'TCP-MIB::tcpListenerProcess.ipv4.\"0.0.0.0\".111'
TCP-MIB::tcpListenerProcess.ipv4.\"0.0.0.0\".111: Unknown Object Identifier (Index out of range: \"0 (tcpListenerLocalAddress))