26
Jolokia - JMX on Capsaicin Roland Huß Chili-Head ConSol* Software GmbH

Jolokia - JMX on Capsaicin (Devoxx 2011)

Embed Size (px)

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.

Citation preview

Page 1: Jolokia - JMX on Capsaicin (Devoxx 2011)

Jolokia - JMX on CapsaicinRoland Huß

Chili-HeadConSol* Software GmbH

Page 2: Jolokia - JMX on Capsaicin (Devoxx 2011)

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

Page 3: Jolokia - JMX on Capsaicin (Devoxx 2011)

JMXJSR-3

JSR-160The Problem

Page 4: Jolokia - JMX on Capsaicin (Devoxx 2011)

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

Page 5: Jolokia - JMX on Capsaicin (Devoxx 2011)

5

JMX Architecture

Page 6: Jolokia - JMX on Capsaicin (Devoxx 2011)

JMX Remote API

• JSR-160 (2003)• Problems:

– Firewalls– Security is typically „all-or-nothing“– Strongly typed– Java only

6

Page 7: Jolokia - JMX on Capsaicin (Devoxx 2011)

OverviewFeatures

ClientsTools

Jolokia

Page 8: Jolokia - JMX on Capsaicin (Devoxx 2011)

How it works

8

Page 9: Jolokia - JMX on Capsaicin (Devoxx 2011)

Agents

JEE OSGi Mule JVM

9

Page 10: Jolokia - JMX on Capsaicin (Devoxx 2011)

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

Page 11: Jolokia - JMX on Capsaicin (Devoxx 2011)

Quickstart

11

Page 12: Jolokia - JMX on Capsaicin (Devoxx 2011)

• HTTP POST

read/http://localhost/jolokia/

Request

• HTTP GET

12

{ "type":"read", "mbean":"java.lang:type=Memory", "attribute":"HeapMemoryUsage" }

java.lang:type=Memory/HeapMemoryUsage

Page 13: Jolokia - JMX on Capsaicin (Devoxx 2011)

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" } }

Page 14: Jolokia - JMX on Capsaicin (Devoxx 2011)

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

Page 15: Jolokia - JMX on Capsaicin (Devoxx 2011)

Bulk Requests

15

[ { "type" : "read", "mbean" : "java.lang:type=Memory", "attribute" : "HeapMemoryUsage", "path" : "used", }, { "type" : "search", "mbean" : "*:type=Memory,*" }]

Page 16: Jolokia - JMX on Capsaicin (Devoxx 2011)

JSR-160 Proxy

16

Page 17: Jolokia - JMX on Capsaicin (Devoxx 2011)

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"}

Page 18: Jolokia - JMX on Capsaicin (Devoxx 2011)

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

Page 19: Jolokia - JMX on Capsaicin (Devoxx 2011)

Groovy

Scala

.....

You ?

Clients

19

Perl Jmx4Perl

Javascript Jolokia

Java Jolokia

Python Jmx4Py Jürgen Herrmann

Node.js jolokia-client Joachim Kainz

Page 20: Jolokia - JMX on Capsaicin (Devoxx 2011)

Javascript Demo

20

Page 21: Jolokia - JMX on Capsaicin (Devoxx 2011)

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();

Page 22: Jolokia - JMX on Capsaicin (Devoxx 2011)

Tools

22

jmx4perl CLI Tool

check_jmx4perl Nagios Plugin

cacti_jmx4perl Cacti Plugin

j4psh JMX Shell

AccessJ iPhone Client

Roo Addon Spring Roo Addon

Page 23: Jolokia - JMX on Capsaicin (Devoxx 2011)

j4psh

23

Page 24: Jolokia - JMX on Capsaicin (Devoxx 2011)

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

Page 25: Jolokia - JMX on Capsaicin (Devoxx 2011)

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

Page 26: Jolokia - JMX on Capsaicin (Devoxx 2011)

Questions ?