首页  

JMX之Jolokia使用     所属分类 jmx 浏览量 2043
Jolokia is a JMX-HTTP bridge giving an alternative to JSR-160 connectors. 
It is an agent based approach with support for many platforms. 
In addition to basic JMX operations it enhances JMX remoting with unique features like bulk requests and fine grained security policies.

The main agent functionality is encapsulated in a core jar, which can be easily used in own projects. 
org.jolokia:jolokia-core

org.jolokia:jolokia-client-java


JVM-Agent	jolokia-jvm-1.6.2-agent.jar


Jolokia as JVM Agent
Attaching a Jolokia agent on the fly  

可运行时 Attaching  Jolokia
https://jolokia.org/reference/html/agents.html#jvm-attach

java -jar jolokia-jvm-1.6.2-agent.jar   start  40434

java -jar jolokia-jvm-1.6.2-agent.jar   stop  40434

java -jar jolokia-jvm-1.6.2-agent.jar   start  40434
Started Jolokia for PID 40434
http://127.0.0.1:8778/jolokia/
dugang:tools dugang$ java -jar jolokia-jvm-1.6.2-agent.jar   stop  40434
Stopped Jolokia for PID 40434

--port  $port
Port to listen on (default: 8778)
  
java -jar jolokia-jvm-1.6.2-agent.jar  --port 9000  start  40434
java -jar jolokia-jvm-1.6.2-agent.jar  --port 9000  stop  40434




jvm启动参数添加  agent

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


-javaagent:/Users/dugang/soft/tools/jolokia-jvm-1.6.2-agent.jar=port=7777,host=*

https://jolokia.org/reference/html/protocol.html


Getting the agent version
http://127.0.0.1:7777/jolokia/version

Listing MBeans (list)
/list/$inner_path

http://127.0.0.1:7777/jolokia/list
http://127.0.0.1:7777/jolokia/list/java.lang
http://127.0.0.1:7777/jolokia/list/java.lang/type=Memory

http://localhost:7777/jolokia/list?maxObjects=7


Searching MBeans (search)
/search/$pattern

http://localhost:7777/jolokia/search/java.lang:*



Reading attributes (read)

/read/$mbean_name/$attribute_name/$inner_path

http://127.0.0.1:7777/jolokia/read/java.lang:type=Memory/HeapMemoryUsage

http://localhost:7777/jolokia/read/java.lang:type=Memory/HeapMemoryUsage/used

http://localhost:7777/jolokia/read/java.lang:type=Memory

http://localhost:7777/jolokia/read/java.lang:type=ClassLoading/Verbose


Writing attributes (write)

/write/$mbean_name/$attribute_name/$value/$inner_path

http://localhost:7777/jolokia/write/java.lang:type=ClassLoading/Verbose/true


Executing JMX operations (exec)


/exec/$mbean_name/$operation_name/$arg1/$arg2/....

http://localhost:7777/jolokia/exec/java.lang:type=Memory/gc


 java agent 简单例子 

上一篇     下一篇
Shenandoah垃圾收集器

httpclient post json数据

jmx信息获取

java类加载知识点

java代码获取所有jvm进程

ETF投资指南