| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<!-- |
| 3 |
~ Copyright 2009-2013 Roland Huss |
| 4 |
~ |
| 5 |
~ Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 |
~ you may not use this file except in compliance with the License. |
| 7 |
~ You may obtain a copy of the License at |
| 8 |
~ |
| 9 |
~ http://www.apache.org/licenses/LICENSE-2.0 |
| 10 |
~ |
| 11 |
~ Unless required by applicable law or agreed to in writing, software |
| 12 |
~ distributed under the License is distributed on an "AS IS" BASIS, |
| 13 |
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 |
~ See the License for the specific language governing permissions and |
| 15 |
~ limitations under the License. |
| 16 |
--> |
| 17 |
|
| 18 |
<chapter id="agents" xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 19 |
<title>Agents</title> |
| 20 |
|
| 21 |
<para> |
| 22 |
Jolokia is an agent based approach to JMX, which requires that clients |
| 23 |
install an extra piece of software, the so-called |
| 24 |
<emphasis>agent</emphasis>. This software either needs to be |
| 25 |
deployed on the target server which should be accessed via remote |
| 26 |
JMX (<xref linkend="agent-mode"/>), or it can be installed on a |
| 27 |
dedicated proxy server (<xref linkend="proxy-mode"/>). For both |
| 28 |
operational modes, there are four different kind of |
| 29 |
agents<footnote> |
| 30 |
<para> |
| 31 |
Although the proxy mode is available for all four agents, you |
| 32 |
are normally free to setup the proxy environment. The |
| 33 |
recommendation here is the war-agent for which very |
| 34 |
lightweight servlet container exists. Tomcat or Jetty are both |
| 35 |
a perfect choice for a Jolokia proxy server. |
| 36 |
</para> |
| 37 |
</footnote>. |
| 38 |
</para> |
| 39 |
<variablelist> |
| 40 |
<varlistentry> |
| 41 |
<term><emphasis role="bold">Webarchive (War) agent</emphasis></term> |
| 42 |
<listitem> |
| 43 |
This agent is packaged as a Java EE Webarchive (War). It is the |
| 44 |
standard installation artifact for Java webapplications and |
| 45 |
probably one of the best known deployment formats. Jolokia ships |
| 46 |
with a war-agent which can be deployed like any other web |
| 47 |
application. This agent has been tested on many Java EE |
| 48 |
servers, from well-known market leaders to rarer species. |
| 49 |
</listitem> |
| 50 |
</varlistentry> |
| 51 |
<varlistentry> |
| 52 |
<term><emphasis role="bold">OSGi agent</emphasis></term> |
| 53 |
<listitem> |
| 54 |
<ulink url="http://www.osgi.org">OSGi</ulink> is a middleware specification |
| 55 |
focusing on modularity and a well defined dynamic lifecycle |
| 56 |
<footnote> |
| 57 |
<para> |
| 58 |
Of course, there is much more to OSGi, a platform and |
| 59 |
programing model which I <emphasis>really</emphasis> |
| 60 |
like. This is my personal pet agent, so to speak ;-). |
| 61 |
</para> |
| 62 |
</footnote>. The Jolokia OSGi agent bundles comes in two |
| 63 |
flavors: a minimal one with a dependency on a running |
| 64 |
<ulink |
| 65 |
url="http://www.osgi.org/javadoc/r4v42/org/osgi/service/http/HttpService.html">OSGi |
| 66 |
HttpService</ulink>, and a all-in-one bundle including an |
| 67 |
embedded <emphasis>HttpService</emphasis> implementation |
| 68 |
(which is exported, too). The former is the recommended, |
| 69 |
puristic solution, the later is provided for a quick startup |
| 70 |
for initial testing the OSGi agent (but should be replaced |
| 71 |
with the minimal bundle for production setups). |
| 72 |
</listitem> |
| 73 |
</varlistentry> |
| 74 |
<varlistentry> |
| 75 |
<term><emphasis role="bold">Mule agent</emphasis></term> |
| 76 |
<listitem> |
| 77 |
<ulink url="http://www.mulesoft.org/">Mule</ulink> is one of the leading Open Source |
| 78 |
Enterprise Service Busses<footnote> |
| 79 |
<para> |
| 80 |
<ulink url="http://answers.yahoo.com/question/index?qid=20071216082739AAfkxnm">What is the proper plural form of "bus"?</ulink> |
| 81 |
</para> |
| 82 |
</footnote> (ESB). It provides a management API |
| 83 |
into which a dedicated Jolokia agent plugs in nicely. This |
| 84 |
agent includes an embedded Jetty for providing JMX HTTP |
| 85 |
access. |
| 86 |
</listitem> |
| 87 |
</varlistentry> |
| 88 |
<varlistentry> |
| 89 |
<term><emphasis role="bold">JVM agent</emphasis></term> |
| 90 |
<listitem> |
| 91 |
Starting with Java 6 the JDK provided by Oracle contains a |
| 92 |
lightweight HTTP-Server which is used e.g. for the reference |
| 93 |
WebService stack implementation included in Java 6. Using |
| 94 |
the Java-agent API (normally used by profilers and other |
| 95 |
development tools requiring the instrumentation during the |
| 96 |
class loading phase), the JVM 6 Jolokia agent is the most |
| 97 |
generic one. It is able to instrument <emphasis>any</emphasis> |
| 98 |
Java application running on a Oracle JDK 6<footnote> |
| 99 |
<para> |
| 100 |
You could even instrument a Java EE application server this way, |
| 101 |
however this is not recommended. |
| 102 |
</para> |
| 103 |
</footnote>. |
| 104 |
This Jolokia agent variant is fully featured, however tends to |
| 105 |
be a bit slow since the |
| 106 |
provided HTTP-Server is not optimized for performance. However |
| 107 |
it is useful for servers like Hadoop or Teracotta, which do |
| 108 |
not provide convenient hooks for an HTTP-exporting agent on |
| 109 |
their own. |
| 110 |
</listitem> |
| 111 |
</varlistentry> |
| 112 |
</variablelist> |
| 113 |
|
| 114 |
|
| 115 |
<xi:include href='agents/war.xml'/> |
| 116 |
<xi:include href='agents/osgi.xml'/> |
| 117 |
<xi:include href='agents/mule.xml'/> |
| 118 |
<xi:include href='agents/jvm.xml'/> |
| 119 |
|
| 120 |
</chapter> |