zoukankan      html  css  js  c++  java
  • java jolokia配置

    [tomcat@wx01 ~]$ java -jar jolokia-jvm-1.3.1-agent.jar
    11504 jolokia-jvm-1.3.1-agent.jar
    11340 org.apache.catalina.startup.Bootstrap start

    运行上面的命令会显示当前该机器上正在运行的MBean server的所有程序的PID。

      我们上面的HelloAgent也在其中。这里假设HelloAgent的PID是11340
    
      $>java -jar jolokia-jvm-1.3.1-agent.jar --agentContext /j4p start 11340
    

    [tomcat@wx01 ~]$ java -jar jolokia-jvm-1.3.1-agent.jar –agentContext /j4p start 11340
    Started Jolokia for PID 11340
    http://127.0.0.1:8778/j4p/

    http://120.55.118.32:8778/j4p/

    [tomcat@wx01 ~]$ perl t1.pl
    Memory Used: 311295648

    [tomcat@wx01 ~]$ jmap -J-d64 -heap 11340 | grep used
    used = 266156128 (253.82626342773438MB)
    24.787721037864685% used
    used = 0 (0.0MB)
    0.0% used
    used = 0 (0.0MB)
    0.0% used
    used = 45139520 (43.04840087890625MB)
    1.5762871065143262% used

    JVM Agent

    Another variant is Jolokia’s JVM agent which does not need any special container environment. The only

    dependency is on Oracle’s JDK 6 or later as runtime, since it contains a lightweight HTTP Server used for

    exporting the Jolokia protocol. This agent is the most generic one which can instrument any Java application

    using a JDK6. It is suitable for situations where the other agents don’t fit. Also, it can be used for

    dynamically attaching an agent to a running Java process.

    For using this agent, the following argument to the Java application to instrument has to be given:

    -javaagent:/path/to/jolokia-jvm--agent.jar
    By default, the agent will listen on port 8778, but this can be configured as well as other aspects like

    authentication:

    Provide options on the commandline as key-value pairs:
    -javaagent:agent.jar=port=7777,host=localhost
    Via a properties file
    -javaagent:agent.jar=config=/path/to/config.properties
    Via packaging a jolokia-agent.properties top level in the agent.jar
    Options are used in the given precedence, the former overwriting the later values.

    For attaching the agent dynamically to a running Java process, the following command can be used to get a quick

    help

    java -jar /path/to/jolokia-jvm--agent.jar –help
    For more details and usage examples please refer to the reference manual.

    另外一个变体是Jolokia’s JVM agent,不需要任何特殊的容器环境。只依赖于Oracle的JDK 6或者后面的版本作为

    runtime,因为它包含一个轻的HTTP服务器。

    服务器用于传输 Jolokia protocol,这个agent是最通用的一个可以任何的Java 应用使用JDK6,

    它适用于其他的代理不适合的, 它用于动态的连接到一个Java 程序。

    对于使用这个代理, 下面的参数对于Java应用来:

    -javaagent:/path/to/jolokia-jvm--agent.jar

    默认,agent会侦听8778端口,但是这个可以被配置如下:

    提供命令行选项键值:

    -javaagent:agent.jar=port=7777,host=localhost

    通过一个属性文件

    -javaagent:agent.jar=config=/path/to/config.properties

  • 相关阅读:
    springboot~使用docker构建gradle项目
    CH BR8(小学生在上课-逆元和互质数一一对应关系)
    UNIX环境高级编程第二版代码笔记
    【Linux学习笔记】用nc实现两台主机间的文件传输(不需要输密码)
    hdu 1159
    轻量级的原型设计工具-Axure RP
    在Ubuntu 12.10 上安装部署Openstack
    [Android 中级]Voip之CSipSimple类库的编绎
    OpenStack云计算快速入门之一:OpenStack及其构成简介
    OpenStack云计算快速入门之二:OpenStack安装与配置
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351357.html
Copyright © 2011-2022 走看看