JMX

g-Solutions

JMX

JMX Benefits

The recommendation is to use Java's Management eXtension (JMX) framework on the Java based systems (Tomcat,  RMI Servers, etc.). 
 
http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/
 
The JMX technology supports monitoring Java based applications. JMX has been incorporated into the Java Stand Edition (J2SE) platform since version 5.0. JMX will provide information related to memory usage, threads and CPU with the JVM. JMX statistical information gathering is an out of box function within each Java application running on JVM version 1.5 or higher. This information is automatically gathered by the Java VM. The change will be to expose this information to be access remotely.
 
The information should help to pin-point the areas of concern within the reviewed applications. This information will be used to identify some of the application code issues. The information gathered will be coupled with various other system assessment strategies.
 
JConsole is a general JMX client. The JConsole client will be used by the performance integration technical team to review the JVM heap usage, memory, threads and other key monitoring information. The following is a view of JConsole;
 
 
 
Pros
The following are some of the typical benefits of using JMX in a Java system.
 
 
See the following link for additional reasons why JMX should be used in Java based systems
http://java.sun.com/javase/6/docs/technotes/guides/jmx/overview/intro.html#wp997785
 
Cons

JMX implementation

 
JMX remote monitoring will use password authentication. The authentication will be setup for the Java server environments.
 

Tomcat Setup

 
  1. Login as the "tomcat" user
  2. Copy the password template file, ${JRE_HOME}/lib/management/jmxremote.password.template, to /opt/tomcat/apache-tomcat-5.5.12/conf /jmxremote.password
  3. Set file permissions so that only the owner can read and write the password file.
    1. chmod 600 /opt/tomcat/apache-tomcat-5.5.12/conf/jmxremote.password
  1. Add password for role such as monitorRole in /opt/tomcat2/apache-tomcat-5.5.12/conf /jmxremote.password (last line in jmxremote.password file)
  2. Backup "catalina.sh" and "shutdown.sh"
  3. Copy /opt/tomcat2/apache-tomcat-5.5.12/bin/catalina.sh to /opt/tomcat2/apache-tomcat-5.5.12/bin/catalina-shutdown.sh
  4. Add the following JVM arguments to /opt/tomcat2/apache-tomcat-5.5.12/bin/catalina.sh (look for JAVA_OPTS)
-Dcom.sun.management.jmxremote.port=7010
-Dcom.sun.management.jmxremote.authenticate=true
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.password.file=/opt/tomcat2/apache-tomcat-5.5.12/conf//jmxremote.password
  1. Edit /opt/tomcat2/apache-tomcat-5.5.12/bin/catalina-shutdown.sh
  2. Edit /opt/tomcat2/apache-tomcat-5.5.12/bin/shutdown.sh
    1. Change "EXECUTABLE=catalina.sh" to "EXECUTABLE=catalina-shutdown.sh"

Windows JMX Password Security Restriction Setup

See the following URL for details

http://download.oracle.com/javase/6/docs/technotes/guides/management/security-windows.html

Also note you must change owner of the file to the security user


Right Click -> Properties -> Security -> Advance -> Owner -> Select a user -> Click OK

JMX Verification

  1. Restart the Tomcat server on the server
  2. From a laptop (with JDK version 1.5 or higher)
  3. Click Start -> run -> jconsole.exe
  4. Connect to tomcat JMX

 

See the following for details

http://tomcat.apache.org/tomcat-6.0-doc/windows-service-howto.html#Command_line_arguments


on server

Click Start -> run

Enter "cmd"

Type d:
cd D:\Sciquest\Tomcat6.0\bin

Enter (one line)
tomcat6.exe //US//"Apache Tomcat 6" --JvmOptions -Xrs -Dcom.sun.management.jmxremote.port=7002
-Dcom.sun.management.jmxremote.authenticate=true
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.password.file= /jmxremote.password