Pages

Tuesday, October 29, 2013

Apache Camel JMX with remote jconsole using host : port

By default when JMX is enabled in apache camel, it binds such that you will have to use a rather encrypted path in jconsole URI for connecting remotely. From there documentation-
service:jmx:rmi://localhost:<connectorPort>/jndi/rmi://localhost:<registryPort>/<serviceUrlPath>
or
service:jmx:rmi://localhost:2000/jndi/rmi://localhost:1099/jmxrmi/camel


You will not be able to connect using localhost:1099 in the jconsole. This was very important to me as I was not just using jconsole but zabbix to gather data from JMX. In case of zabbix the only option that is available was host:port. The reason this does not work is the serviceUrlPath which by default in camel is customized to /jmxrmi/camel instead of the more known /jmxrmi. The fix is easy as show below-

<camelContext id="camelAppContext" xmlns="http://camel.apache.org/schema/spring">
<propertyPlaceholder id="properties"
location="classpath:common.properties"/>
<jmxAgent id="camelAppJmxAgent" registryPort="{{jmx.registry.port}}" connectorPort="{{jmx.connector.port}}"
createConnector="true" serviceUrlPath="/jmxrmi"/>
</camelContext>

Or by using the JMX from –D options.
-Dorg.apache.camel.jmx.serviceUrlPath=/jmxrmi

With this configuration you can connect using host:port (localhost:1099) to JMX using jconsole.

No comments:

Post a Comment