Mule Agent Installation

Jolokia has also a Mule ESB agent which can be deployed on the Mule ESB (running in standalone mode).

The agent jar needs to be stored within the Mule installation in lib/opt/. Additionally, the Mule configuration needs to be adapted to contain the following section:

<mule xmlns="http://www.mulesoft.org/schema/mule/core"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:spring="http://www.springframework.org/schema/beans"
    xmlns:management="http://www.mulesoft.org/schema/mule/management"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-current.xsd
             http://www.mulesoft.org/schema/mule/core
       http://www.mulesoft.org/schema/mule/core/current/mule.xsd
             http://www.mulesoft.org/schema/mule/management
       http://www.mulesoft.org/schema/mule/management/current/mule-management.xsd">

   <!-- .... -->
   <custom-agent name="jolokia-agent" class="org.jolokia.mule.JolokiaMuleAgent">
      <spring:property name="port" value="8899"/>
   </custom-agent>
</mule>

Starting up mule doesn't yield a startup message anymore, but you can test it by calling the jolokia URL:

   http://localhost:8899/jolokia

Note the Jolokia agent can be used by a client like jmx4perl, check_jmx4perl or j4psh like

 jmx4perl http://localhost:8899/jolokia list

which will result in an output similar to

 Mule.myMule:
    Mule.myMule:name=AllStatistics,type=org.mule.Statistics
        Attributes:
            Enabled                             boolean
        Operations:
            void logSummary()
            java.lang.String printXmlSummary()
            java.lang.String printHtmlSummary()
            void clear()
            java.lang.String printCSVSummary()

 ....
 java.lang:
    java.lang:type=Memory
        Attributes:
            NonHeapMemoryUsage                  CompositeData [ro]
            ObjectPendingFinalizationCount      int [ro]
            Verbose                             boolean
            HeapMemoryUsage                     CompositeData [ro]
        Operations:
            void gc()

Note that Mule was started here with a server id myMule (startup option: -M-Dmule.serverId=myMule). As you can see you have access to the Mule specific MBeans and the Java platform MXBeans (which BTW is not easy achievable using Mules JSR-160 agents directly).

For enabling basic security the properties user and password can be set:

 <custom-agent name="jolokia-agent" class="org.jolokia.mule.JolokiaMuleAgent">
   <spring:property name="user" value="roland"/>
   <spring:property name="password" value="wtf"/>
 </custom-agent>

On the client side the options --user and --password can be used with jmx4perl and check_jmx4perl for specifying the credentials.

Finally, all other options as specified as init parameters in jolokia.wars web.xml can be used as properties here as well.