jolokia - jmx on capsaicin (devoxx 2011)
DESCRIPTION
"Jolokia - JMX on Capsaicin" was given as a "Tools in Action" talks at Devoxx 2011. For the full presentation, please go to parleys.com which includes a full recording of the talk.TRANSCRIPT
Jolokia - JMX on CapsaicinRoland Huß
Chili-HeadConSol* Software GmbH
Me and the Chili
• Development and Operations @ ConSol– Large Java Projects– Remote Operations– Open Source Monitoring (Nagios)– www.consol.com
• Open Source Author– [email protected]– https://github.com/rhuss
• Chili grower since 2005
2
JMXJSR-3
JSR-160The Problem
JMX Refresher
• Java Management Extensions (JMX)• JSR-3 (2000)• Available out of the box since JDK 1.5• JMX-Operations:
– Attribute reading– Attribute writing– Execution of operations– Notifications
4
5
JMX Architecture
JMX Remote API
• JSR-160 (2003)• Problems:
– Firewalls– Security is typically „all-or-nothing“– Strongly typed– Java only
6
OverviewFeatures
ClientsTools
Jolokia
How it works
8
Agents
JEE OSGi Mule JVM
9
Tested on ...
10
Tomcat 5.5, 6.0, 7.0
Jetty 5.1, 6.1, 7.5, 8.0
Weblogic 9.2.3, 10.0.2, 10.3.5
Websphere 6.1, 7.0, 8.0
Glassfish 2.1, 3.0, 3.1
JBoss 4.2, 5.1, 6.1, 7.0
Jonas 4.10, 5.1, 5.2
Geronimo 2.1, 2.2, 3.0 M1
Camel 2.8
Felix 2.0, 3.2, 4.0
Equinox 3.5, 3.6, 3.7, 3.8 M1
Knopflerfish 3.2
Virgo 2.1, 3.0
Spring dm Server 2.0
Mule 2.2, 3.1, 3.2
ActiveMQ 5.5
Terracotta 3.2
Hadoop 0.20
Quickstart
11
• HTTP POST
read/http://localhost/jolokia/
Request
• HTTP GET
12
{ "type":"read", "mbean":"java.lang:type=Memory", "attribute":"HeapMemoryUsage" }
java.lang:type=Memory/HeapMemoryUsage
Response
13
{ "value": { "init": 134217728, "max": 532742144, "committed": 133365760, "used": 19046472 }, "status": 200, "timestamp": 1244839118, "request": { "mbean": "java.lang:type=Memory", "type": "read", "attribute": "HeapMemoryUsage" } }
Request Types
14
version Version and server information
read Reading of attributes
write Writing of attributes
exec Execution of operations
search Pattern search for MBeans
list MBean meta data
Bulk Requests
15
[ { "type" : "read", "mbean" : "java.lang:type=Memory", "attribute" : "HeapMemoryUsage", "path" : "used", }, { "type" : "search", "mbean" : "*:type=Memory,*" }]
JSR-160 Proxy
16
Proxy Request
17
{ "attribute" : "HeapMemoryUsage", "mbean" : "java.lang:type=Memory", "target": { "url" : "service:jmx:iiop://websphere:2810/jndi/JMXConnector" "user" : "roland", "password" : "s!cr!t" }, "type" : "READ"}
Security
• JSR-160 Security– Java Security and JAAS
• Jolokia Security– HTTP Security– Access Control with Policy Files
• Network location• Command types• MBean, attribute and operation names
18
Groovy
Scala
.....
You ?
Clients
19
Perl Jmx4Perl
Javascript Jolokia
Java Jolokia
Python Jmx4Py Jürgen Herrmann
Node.js jolokia-client Joachim Kainz
Javascript Demo
20
Javascript
21
var j4p = new Jolokia("/jolokia"); var data = [];
function run() { j4p.request({ type: "read", mbean: "java.lang:type=Memory", attribute: "HeapMemoryUsage" }, { success: function(resp) { data.push([resp.timestamp,resp.value.used]); $.plot($("#memory"),[data],{ xaxis: { mode: "time" }}); setTimeout(run,1000); } }); } run();
Tools
22
jmx4perl CLI Tool
check_jmx4perl Nagios Plugin
cacti_jmx4perl Cacti Plugin
j4psh JMX Shell
AccessJ iPhone Client
Roo Addon Spring Roo Addon
j4psh
23
Wrap up
• JMX is good• JSR-160 connectors are bad • Jolokia ...
... is a JSON-HTTP adaptor to JMX ... has unique features ... allows for non-Java clients ... has good tool support
24
Resources
• www.jolokia.org• Reference-Manual: http://www.jolokia.org/reference/html/• Forum: http://www.jolokia.org/forum.html
• Blog• ConSol Labs: http://labs.consol.de
• Github• https://github.com/rhuss/jolokia
• T-Shirts ;-)• http://jolokia.spreadshirt.de
• Twitter: @jolokia_jmx25
Questions ?