SNMPAgent adaptor does not respect jboss.bind.address
rali.genova May 17, 2006 6:37 PMThere is a problem with the SNMP Agent in the latest 4.0.x code as well as in 4.0.4CR2. The service does not respect the jboss.bind.address configuration. When I start two instances of the all configuration, the addresses conflict even though the servers are running on two different IPs. It appears that SNMPAgent is bound to *:1161 instead of the value passed to jboss.bind.address. Here are the steps to reproducing the bug:
- checkout latest 4.0.x branch
- build and copy the all configuration into two new configurations, I named them node0 and node1
- start node0 using the -b option and binding it to private IP address, other than localhost
- start node1 again binding it to another IP.
Here is the exception trace seen during startup of node1:
2006-05-17 14:34:25,880 DEBUG [org.jboss.jmx.adaptor.snmp .agent.SnmpAgentService] Starting snmp agent ... 2006-05-17 14:34:25,892 DEBUG [org.jboss.jmx.adaptor.snmp.agent.SnmpAgentService] Starting failed jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor java.net.BindException: Address already in use at java.net.PlainDatagramSocketImpl.bind(Native Method) at java.net.DatagramSocket.bind(DatagramSocket.java:368) at java.net.DatagramSocket.<init>(DatagramSocket.java:210) at java.net.DatagramSocket.<init>(DatagramSocket.java:261) at org.opennms.protocols.snmp.SnmpPortal.<init>(SnmpPortal.java:256) at org.opennms.protocols.snmp.SnmpPortal.<init>(SnmpPortal.java:204) at org.opennms.protocols.snmp.SnmpAgentSession.<init>(SnmpAgentSession.java:357) at org.jboss.jmx.adaptor.snmp.agent.SnmpAgentService.startAgent(SnmpAgentService.java:577) at org.jboss.jmx.adaptor.snmp.agent.SnmpAgentService.startService(SnmpAgentService.java:496) at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
Since I am binding the two instances to different IPs, there shouldn't be any collisions in addresses, so I used netstat to check if those bindings were correct:
java 19054 rgenova 12u IPv4 -1117543693 UDP *:1161
From this line you can see port 1161 is listening on * instead of my private IP which causes the problem above when the second instance starts up. 1161 is configured in deploy/snmp-adaptor.sar/META-INF/jboss-service.xml
<mbean code="org.jboss.jmx.adaptor.snmp.agent.SnmpAgentService" name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor"> ... <attribute name="Port">1161</attribute> ...