[SNMP4J] TCP Trap receiver stops working
Wayne T
weeznat at hotmail.com
Fri Jan 11 20:48:38 CET 2013
I'm using the snmp trap receiver to execute some testing and seem to be getting to a point where the trap receiver stop responding.
To start the trap receiver, I'm using the following command:
java -cp snmp4j-2.1.0.jar:log4j-1.2.15.jar org.snmp4j.tools.console.SnmpRequest -d DEBUG -u aSecurityName -Ol TCP:0.0.0.0/1162
The trap receiver is working initially when I start it, but it stops responding after some time.
As far as I've been able to diagnose, it looks like it stops working after a client opens a TCP connection but does not send any traps.
So, if do the following, then TCP trap receiver stops working:
1 - start the trap receiver with the command above
2 - send a trap with this command:
java -cp snmp4j-2.1.0.jar:log4j-1.2.15.jar org.snmp4j.tools.console.SnmpRequest -p INFORM -v 2c -u aSecurityName TCP:127.0.0.1/1162 "1.3.6.1.2.1.1.3.0={t}0" "1.3.6.1.6.3.1.1.4.1.0={o}1.3.6.1.6.3.1.1.5.1" "1.3.6.1.2.1.1.1.0={s}System XYZ, Version N.M"
This trap is received
3 - run the following java program that opens a socket and then closes it:
public static void main(String[] args)
{
try
{
SocketChannel socketChannel = SocketChannel.open();
socketChannel.connect(new InetSocketAddress(-_YOUR_IPADDRESS-, 1162));
socketChannel.close();
}
catch (Throwable t)
{
System.out.println("Failed to send connect: " + "\nReason: "
+ t.toString());
}
}
4 - repeat the command in step 2, and the trap is not printed in the trap receiver output and the command prints the following message:
2017 [main] DEBUG org.snmp4j.transport.DefaultTcpTransportMapping - Socket to 127.0.0.1/1162 closed
2017 [main] DEBUG org.snmp4j.transport.DefaultTcpTransportMapping - Socket channel to 127.0.0.1/1162 closed
Request timed out.
More information about the SNMP4J
mailing list