Jconsole can monitor the memory usage of Java processes on the remote host. This article explains how to use Jconsole to monitor WebLogic and Tomcat on a remote host.
First, the environment
1. Native Environment: Windows Xp+jconsole (jdk1.6)
2. Remote Environment 1:sunos (Solaris, jdk1.6) +weblogic
3, Remote Environment 2:redhat (jdk1.6) +tomcat
This article will describe the configuration of the two environments, the configuration is basically the same, the other systems should be similar.
Two, remote connection SunOS (Solaris) +weblogic
1, jconsole use JMX for monitoring, need to configure the startup parameters when the application starts. Because the WebLogic server is used, it needs to be configured in the ${DOMAIN_HOME}/BIN/SETDOMAINENV.SH environment.
Java_options= "${java_options}-dcom.sun.management.jmxremote.port=9000" java_options= "${JAVA_OPTIONS}- Dcom.sun.management.jmxremote.authenticate=false "java_options=" ${java_options}- Dcom.sun.management.jmxremote.ssl=false "
2, view/etc/hosts, by default, the hostname has been mapped to the IP, so there is no need to adjust.
:: 1 localhost127.0.0.1 localhost10.1.97.20 C20 c20.sinosure.com.cn loghost
3. Modify the ${java_home}/jre/lib/management directory properties
Chmod-r 777./management
4, start WebLogic, and on the local open jconsole for remote connection, select "Remote Process", enter the host IP and port number.
Click "Connect" to display the Monitoring interface:
Note: When you start and close WebLogic, the setdomainenv.sh script is called. If the configuration is complete and the WebLogic is started, and then WebLogic is turned off, the port number is indicated to be occupied, because the listener for that port number is started when WebLogic is started and closed. Consider adding a judgment to the setdomainenv.sh to start listening on the port number only when the WebLogic is started.
Third, remote connection Redhat+tomcat
1, the first step of the same section, the difference is that Tomcat at startup, set the parameters of the file when catalina.sh, so the parameters need to be set here.
java_opts= "$JAVA _opts-djava.rmi.server.hostname=192.168.1.110" "java_opts=" $JAVA _opts- dcom.sun.management.jmxremote.port=9000 "java_opts=" $JAVA _opts-dcom.sun.management.jmxremote.authenticate=false "Java_opts=" $JAVA _opts-dcom.sun.management.jmxremote.ssl=false "
2, for Redhat, by default, hostname does not correspond to IP. On Redhat, you can use Hostname-i to view, if 127.0.0.1 is displayed, you need to configure/etc/hosts.
#127.0.0.1 localhost.localdomain localhost192.168.1.110 localhost.localdomain localhost
Note: The 127.0.0.1 line is commented, and the hostname corresponds to 192.168.1.110.
3. Configure the files under the ${java_home}/jre/lib/management directory.
CP Jmxremote.password.template Jmxremote.password
To restore the commented out content:
Monitorrole Qedcontrolrole
To execute a command, modify the file properties:
chmod jmxremote.accesschmod Jmxremote.password
4, can refer to the fourth step of the previous section.
Note: When you start and close Tomcat, the catalina.sh script is called. If the configuration is complete and Tomcat is started, and then the Tomcat is turned off, the port number is indicated to be in use because the listener for that port number is started when Tomcat is started and shut down. It is considered that the listener for that port number is initiated only when Tomcat is started by judging that the parameter is start.
With the above configuration, it can be seen that the configuration on the SunOS system and the Redhat system is not exactly the same, the same configuration in Tomcat is not exactly the same, you need to pay attention to the differences.
Four, check and exception handling
1, after the boot, the system will start monitoring the configuration port, you can use the command to see if the normal startup:
Netstat-an | grep 9000
If there is a monitor, the instructions start normally.
2, after starting the Jconsole, the prompt connection is not on, but found on the remote host that the port has been connected (can be viewed through Netstat-an).
Check that the configuration is incorrect, or see if the firewall is off.
Jconsole monitoring remote WebLogic and Tomcat