tags:

views:

284

answers:

2

I have just started using JMX to monitor activemq,i have enabled remote monitoring. Now the question is,How do i allow only localhost have access to JMX API? Or is there a way i can use JMX API without enabling remote monitoring..

+2  A: 

After spending hours of my time googling for a solution, i came across this article https://wiki.internet2.edu/confluence/display/CPD/Monitoring+Tomcat+with+JMX which shows how to configure JMX for tomcat and how to expose JMX over rmi. The option "-Djava.rmi.server.hostname=test-idc.internet2.edu" indicates the name of the host on which tomcat is running. If you donot specify the hostname then trying to connect from a remote machine returns 'Connection failed'.

All you need to do is to set the property -Djava.rmi.server.hostname=localhost in your activemq startup script

if [ -z "$SUNJMX" ] ; then #SUNJMX="-Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false" SUNJMX="-Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=localhost" fi

Thats it... restart activemq and you have jmx accessible only from your local machine.

Sudheer
A: 

Alas StackOverflow won't let me delete comments. I previously said that this was not a good solution but it is.

Eamonn McManus