English 中文(简体)
Get Target Ip Address From SNMP4j Trap receivedr
原标题:Get Target Ip Address From SNMP4j Trap Receiver

我使用幻灯4j制造刺.器。 我设法接收了该节目并处理。 由于我的机器有多个预期地址,我需要有目标的预期地址。 我可以考虑两种方式:

  1. Retrieve entire command in my trap receiver which is "snmpset -v 1 -c M xx.xxx.x.x 1.3.6.1.4.1.161.3.6.37.2.1.3.2 i 2" so that I can get the ip address by removing other strings." But the only thing I could retrieve is only the variable, value and pdu type.
  2. Using method to retrieve the targeted ip address. But couldn t find one. I used event.getTransportMapping().getListenAddress() but getting 0.0.0.0/161 as I need to listen to many ip address. Used event.getPeerAddress() but getting ip address of the sender s machine.

真正感谢任何帮助。 提前感谢。

最佳回答

具体如下:

UdpAddress udpHostAdress = (UdpAddress) cmdRespEvent.getTransportMapping().getListenAddress();
String ipAdd = udpHostAdress.getInetAddress().getHostAddress();
System.out.println("Target IP = " + ipAdd); 
问题回答

如果你试图处理trap接收器的安全,那么你就错了在这里使用刺.-3处理。 v3 设有称为 Engine ID的安保机制。

我也遇到了同样的问题,但你的解决办法对我不利。 我能否看到你们的完全的听众。 感谢。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签