我一直在尝试从诺基亚设备接收SNMPv3陷阱。我引用了所有文档和堆栈溢出信息,但仍然无法解决问题。请帮忙。这里的侦听器地址是IPV6和端口1162
public void start() throws IOException {
logger.info("starting to listen form traps");
threadPool = ThreadPool.create("Trap", 10);
dispatcher = new MultiThreadedMessageDispatcher(threadPool, new MessageDispatcherImpl());
InetAddress inetAddress = null;
try {
logger.info("start listening to address " + listenAddress);
inetAddress = InetAddress.getByName(listenAddress);
} catch (Exception e) {
logger.error("Exception while construction inetaddress", e);
}
TransportIpAddress transportAddress = null;
logger.info("UDP a and --> Protocal is " + protocol);
logger.info("inetAddress and listenPort is " + inetAddress + ": " + listenPort);
try {
if ("UDP".equals(protocol)) {
transportAddress = new UdpAddress(inetAddress, listenPort);
transport = new DefaultUdpTransportMapping((UdpAddress) transportAddress);
transport.setReceiveBufferSize(receiveBufferSize);
}
} catch (IOException ex) {
logger.error("Exception thrown while configuring transport ", ex);
NodeManager.TRAP_OK = false;
}
USM usm = new USM(SecurityProtocols.getInstance(), new OctetString(MPv3.createLocalEngineID()), 0);
usm.setEngineDiscoveryEnabled(true);
SecurityProtocols.getInstance().addDefaultProtocols();
SecurityProtocols.getInstance().addPrivacyProtocol(new Priv3DES());
SecurityModels.getInstance().addSecurityModel(usm);
snmp = new Snmp(dispatcher, transport);
snmp.getMessageDispatcher().addMessageProcessingModel(new MPv2c())
snmp.getMessageDispatcher().addMessageProcessingModel(new MPv3(usm));
String username = "temp";
String authProtocal = "temp";
String authPassword = "temp";
String privacyProtocal = "temp";
String privacyPassword = "temp";
snmp.getUSM().addUser(new OctetString(username), new UsmUser(new OctetString(username),
AuthMD5.ID,new OctetString(authPassword), Priv3DES.ID, new OctetString(privacyPassword)));
snmp.addCommandResponder(this);
try {
snmp.listen();
}
}
} catch (IOException ex) {
logger.error("Exception thrown while calling transport.listen() ", ex);
NodeManager.TRAP_OK = false;
}
logger.info("snmp.listen " + snmp.toString());
}
我一直在尝试从诺基亚设备接收SNMPv3陷阱。请帮忙。 V2陷阱使用相同的代码,但无法接收V3陷阱
我上个月也面临着同样的问题。无法弄清楚。有人可以帮我吗。