zoukankan      html  css  js  c++  java
  • JVM监控

    jconsole

    说明:

    首先JConsole这个是JDK里面自带的工具  在JAVA_HOME/bin目录下,今天主要测试远程监控JVM 

    第一步:设置好需要远程机器的Tomcat 

    修改Tomcat下的配置文件:/opt/tomcat7/bin/catalina.sh

    在 文件中找到----- Execute The Requested Command --这一行,在这一行上面设置如下代码:

    JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=47.107.183.88"

    JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=47.107.183.88"
    
    # ----- Execute The Requested Command -----------------------------------------

    //注意中间没有换行,这是一条语句;hostname的IP为要监控的服务器的IP地址

    第二步:配置完成后重启Tomcat

    /usr/local/apache-tomcat-7.0.41/bin/shutdown.sh   //关闭Tomcat

    /usr/local/apache-tomcat-7.0.41/bin/startup.sh  //重启Tomcat

    netstat -an| grep 12345  //查看配置的端口号是否启动

    第三步:在Windows系统上打开Jconsole

    C:Program FilesJavajdk1.8.0_92inJconsole.exe   //根据自己实际路径查找,打开后如下图:

    选择远程进程,这里有两种连接方式,这里选择第一种<hostname>:<port>的方式,如下图:

    配置完成后点击连接,会有一条提示,这里我们选择以不安全的方式连接即可,最后如下图:

    jprofile

    前提条件:

    windows下安装好jprofile

    linux下解压好profile

    # tar -zxvf jprofiler_linux_7_2_3.tar.gz

    接下来,打开window端的jprofile:

    选择:linux,next

    随便选,next:

     直接 next:

     填写需要监控的 ip ,next :

    输入 linux 内 jprofile 的目录 ,next:

    [root@xiaowenshu jprofiler7]# pwd
    /opt/jprofiler7

    默认端口:8849 ,确保linux的改端口没有被占用,直接 next :

    远程 jvm 启动添加此参数来监听 windows 客户端:

    -agentpath:/opt/jprofiler7/bin/linux-arm/libjprofilerti.so=port=8849

     

    配置linux:

    修改Tomcat下的配置文件:/opt/tomcat7/bin/catalina.sh

    在 文件中找到----- Execute The Requested Command --这一行,在这一行上面设置如下代码:

    -agentpath:/opt/jprofiler7/bin/linux-arm/libjprofilerti.so=port=8849

    改好了,重启 tomcat

     如果要两个都用的话:配置如下:

    JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=47.107.183.88"


    CATALINA_OPTS="-agentpath:/opt/jprofiler7/bin/linux-x64/libjprofilerti.so=port=8849,nowait $CATALINA_OPTS" export CATALINA_OPTS

    如果单独配置一个:想用哪个,注释掉另一个

    
    
    JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=47.107.183.88"

    JAVA_OPTS="
    -agentpath:/opt/jprofiler7/bin/linux-x64/libjprofilerti.so=port=8849,nowait $CATALINA_OPTS"

    next ,finsh 完成 session创建

    ok

    这样,初步就ok

  • 相关阅读:
    CEIWEI CommTone串口调试精灵7.1 串口调试 串口工具
    CEIWEI USBMonitor USB监控精灵 v2.3.2 USB过滤驱动 USB监控
    CommMonitor8.0 串口过滤驱动 SDK DLL版本 C#/Delphi调用DEMO
    CommMonitor10.0.3串口过滤工具(serial port monitor)
    (1)、JEasyUI 之 Datagrid的Combobox 显示 textField 值的问题
    button 使用 flex 布局的兼容性问题
    探索 Reflect.apply 与 Function.prototype.apply 的区别
    awk 输出前 N 列的最简单方法
    在 Ubuntu 18.04 下安装 fcitx 及搜狗拼音输入法
    禁用 Gnome Shell 默认的 Ubuntu Dock 和 Ubuntu AppIndicators 扩展
  • 原文地址:https://www.cnblogs.com/xiaowenshu/p/10217045.html
Copyright © 2011-2022 走看看