SNMPトラップをSNMPサーバに送信しています。しかし、サーバーへの接続が確立されていない場合は、ログを出力する必要があります。SNMPサーバ接続
UdpAddress targetAddress = new UdpAddress("127.0.0.1/1985");
CommunityTarget target = new CommunityTarget();
target.setCommunity(new OctetString("public"));
target.setAddress(targetAddress);
target.setRetries(2);
target.setTimeout(1000);
target.setVersion(SnmpConstants.version1);
Snmp snmp = new Snmp(new DefaultUdpTransportMapping());
snmp.listen();
// prepare the PDU for sending
PDU command = new PDU();
command.setType(PDU.GET);
command.add(new VariableBinding(new
OID("1.3.6.1.4.1.1331.11.5.1.0")));
// now send the PDU
**// I HAVE TO CHECK WETHER CONNECTION IS ESTABLISHED OR NOT WITH SNMP SERVER. AS OF
NOW EVEN IF I DO NOT START SNMP SERVER THAN I AM NOT GETTING ANY EXCEPTION and IF I START
SNMP SERVER THEN MESSAGE HAS BEEN SENT TO SNMP SERVER.....MAY BE IN SEND METHOD..ITS
CONNECTS WITH SNMP SERVER....BUT I TRIED TO FIND OUT BUT COULDNT ABLE TO DO IT.....**
ResponseEvent responseEvent = snmp.send(pdu, target);
を送信するためにSNMP4j上に読むことをお勧めしますいくつかのリンクを、TCP上でSNMPを実行する可能性があるでしょう。標準があります - RFC3440 - と方法。しかし、一般的な使用法はありません。 – tofro
@tofroこれはドラフトなので、すべてのベンダーがサポートしているわけではありません。 –