Sunday, May 16, 2010

JMX Command Line Client

skajla-JMXClient is a open source, command-line based JMX client, which provides a centralized console for managing application clusters and distributed-application environments. The skajla-JMXClient mission is to provide an open source management platform, which can be used to manage and monitor complete production environment using open source monitoring tools like Zabbix, Naggios. 

skajla-JMXClient can be used to connect to the SUN JVM JDK 1.5.0 JMX Agent to set logging levels remotely and to get information on the running JVM. It is specially designed to return only the output value, which can be easily monitored using monitoring tools.

e.g Zabbix Agent configuration for capturing Perm Gen init memory.
UserParameter=permgen_init, java -jar skajla-JMXClient.jar 9999 admin jmxpass 'java.lang:type=MemoryPool,name=PS Perm Gen' CollectionUsage init
Above mentioned command will return Perm Gen Init memory value only, which can be easily capture by Zabbix or any other monitoring tool.

Command to check all available message bean which user can capture using this utilty:
#java -jar skajla-JMXClient.jar 9999 admin jmxpass info

To use, do the following to obtain usage: 
# java -jar skajla-JMXClient.jar 
Usage :skajla-JMXClient.jar

OR, To Display All Registered bean info 
Note : Provide multiple commands & attributes separated by comma(,)

Command Options Description:  
JMX Server IP : IP Address of the jmx server  
JMX PORT : Port on which JMX service is running
JMX USER : Username required to connect to the JMX  

JMX PASSWORD : Password required to connect to the JMX  
MESSAGE BEAN : Target Bean for which attribute Value is required  
COMMAND : Operation to run or attribute to fetch, Attributes begin with
a capital letter.  

ATTRIBUTE : Optional, require in the cases when command output into multiple values
e.g Max Heap Memory Value.

JDK1.6,If connecting to a SUN 1.5.0 JDK JMX Agent, remote side must be started with 
system properties such as the following: