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:management="http://www.mulesoft.org/schema/mule/management"
    xmlns:spring="http://www.springframework.org/schema/beans" 
    xsi:schemaLocation="
       http://www.mulesoft.org/schema/mule/core 
             http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd
       http://www.springframework.org/schema/beans 
             http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
       http://www.mulesoft.org/schema/mule/management 
             http://www.mulesoft.org/schema/mule/management/3.1/mule-management.xsd">

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

Starting up mule should yield a startup message like

**********************************************************************
* Mule ESB and Integration Platform                                  *
* Version: 3.1.2 Build: 21975                                        *
* MuleSoft, Inc.                                                     *
* For more information go to http://www.mulesoft.org                 *
*                                                                    *
* Server started: 8/26/11 11:26 PM                                   *
* JDK: 1.6.0_26 (mixed mode)                                         *
* OS: Mac OS X (10.6.8, x86_64)                                      *
* Host: dev4.local (10.9.11.128)                                     *
* Agents Running:                                                    *
*   Wrapper Manager: Mule PID #0, Wrapper PID #861                   *
*   Jolokia Agent: http://localhost:8899/jolokia                     *
*   JMX Agent                                                        *
**********************************************************************

Note the URL for the Jolokia agent which 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>
 <management:jmx-server/>

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.