Introduction
This how-to will show how to monitor a installation of Jboss with OP5 Monitor and the plugin check_jmx.
Java Management Extensions (JMX) is a Java technology that supplies tools for managing and monitoring applications, system objects, devices (e. g. printers) and service oriented networks. Those resources are represented by objects called MBeans (for Managed Bean).*
JMX exposes a set of 'Managed bean' (MBean) wich represents a resource running in the Java Virtual Machine.
The JMX implementation of a java application server typically exposes resource usage statistics (memory, threads used etc) and lots of other statistics/metrics. Apart from generic information the application server vendor also provide MBeans specific for the application server in question.
Standard JMX using RMI is no longer available in JBoss AS as of version 7.1
Functionality
The check_jmx
plugin enables you to monitor the values of any MBean attribute made available through JMX.
Prerequisites
The JMX agent need to be enabled at the application server that is being monitored. The agent must be configured to allow remote connections over RMI ((Java) Remote Method Invocation). Refer to the application server documentation for details on how to set this up.
It is also possible to run the checks in this how-to with a username and password to increase security, this how-to will not cover that. Please refer to your application servers manual how to set that up.
Installation
The check_jmx plugin is included in the op5-plugins package and is located in /opt/plugins
. Metadata/checkcommand information is installed in /opt/plugins/metadata/check_jmx.metadata
.
You will also need java installed in your op5 Monitor, you can install java via yum from our repositories: "yum install java-1.7.0-openjdk
"
More information regarding java installation and it's versions can be found through the CentOS community: http://wiki.centos.org/HowTos/JavaOnCentOS
Usage
The plugin consist of a shell script wrapper (check_jmx
) and a java jar file (check_jmx.jar
). When running the plugin the shell script should be invoked, the jar file should not be used directly. The plugin consist of a shell script wrapper (check_jmx
) and a java jar file (check_jmx.jar
). When running the plugin the shell script should be invoked, the jar file should not be used directly.
./check_jmx -U -O
Examples
You can test the different checks from command-line to verify that they works before you implement them into op5 Monitor. check the 'used' key of attribute 'HeapMemoryUsage' in the object: 'java.lang:type=Memory'
cd /opt/plugins./check_jmx -U service:jmx:rmi:///jndi/rmi://'app-server':'1090'/jmxrmi -O java.lang:type=Memory -A HeapMemoryUsage -K "used"
Check the 'ThreadCount' attribute in the object 'java.lang:type=Threading'
./check_jmx -U service:jmx:rmi:///jndi/rmi://'app-server':'1090'/jmxrmi -O java.lang:type=Threading -A ThreadCount -K ""
Check available connections in the connection-pool in the object 'jboss.jca:name=JmsXA,service=ManagedConnectionPool' with the attribute 'AvailableConnectionCount'
./check_jmx -U service:jmx:rmi:///jndi/rmi://'app-server':'1090'/jmxrmi -O jboss.jca:name=JmsXA,service=ManagedConnectionPool -A AvailableConnectionCount
Check Commands
Add the required check-commands, if they don't already exist in your configuration ('Configure' -> 'Commands' -> 'Check Command Import'):
command_name | command_line |
check_jmx_current_threadcount | $USER1$/check_jmx -U service:jmx:rmi:///jndi/rmi://'$HOSTADDRESS$':'$ARG1$'/jmxrmi -O java.lang:type=Threading -A ThreadCount -K "" -w $ARG2$ -c $ARG3$ |
check_jmx_garbage_collection_timing | $USER1$/check_jmx -U service:jmx:rmi:///jndi/rmi://'$HOSTADDRESS$':'$ARG1$'/jmxrmi -O "java.lang:type=GarbageCollector,name=PS MarkSweep" -A LastGcInfo -K duration -w $ARG2$ -c $ARG3$ -u ms |
check_jmx_heapmem_used | $USER1$/check_jmx -U service:jmx:rmi:///jndi/rmi://'$HOSTADDRESS$':'$ARG1$'/jmxrmi -O java.lang:type=Memory -A HeapMemoryUsage -K used -w $ARG2$ -c $ARG3$ -u B |
check_jmx_long_running_threads | $USER1$/check_jmx -U service:jmx:rmi:///jndi/rmi://'$HOSTADDRESS$':'$ARG1$'/jmxrmi -O jboss.threads:name=LongRunningTasksThreadPool,type=queuelessThreadPool -A CurrentThreadCount -K "" -w $ARG2$ -c $ARG3$ |
check_jmx_nonheap_mem_used | $USER1$/check_jmx -U service:jmx:rmi:///jndi/rmi://'$HOSTADDRESS$':'$ARG1$'/jmxrmi -O java.lang:type=Memory -A NonHeapMemoryUsage -K used -w $ARG2$ -c $ARG3$ -u B |
check_jmx_availible_connections_in_pool | $USER1$/check_jmx -U service:jmx:rmi:///jndi/rmi://'$HOSTADDRESS$':'$ARG1$'/jmxrmi -O jboss.jca:name=JmsXA,service=ManagedConnectionPool -A AvailableConnectionCount -K "" -w $ARG2$ -c $ARG3$ |
Adding Services
Add the required services, ('Configure' -> 'Host: ' -> 'Go' -> 'Services for host ' -> 'Add new service' -> 'Go'):
Add the following services (Arguments are just examples, you need to adjust them to suite your environment).
service_description | check_command | check_command_args |
Current Threadcount | check_jmx_current_threadcount | 1090!100!120 |
Garbage Collection Timing | check_jmx_garbage_collection_timing | 1090!3500!4000 |
HeapMem Usage | check_jmx_heapmem_used | 1090!140000000!150000000 |
Check Long Running Threads | check_jmx_long_running_threads | 1090!3!5 |
NonHeap Memory Usage | check_jmx_nonheap_mem_used | 1090!100000000!120000000 |
Availible Connections in pool | check_jmx_availible_connections_in_pool | 1090!20!25 |
Other
This is just an example of some parameters that you can monitor with check_jmx, for more detailed information, please refer to the developers site. We recommend that you also monitor the server that is running JBoss at a lower level, i.e on operating system level with for example NRPE to get more detailed information about the underlying operating system. More information: http://www.op5.com/agents/nagios-remote-plugin-executor-nrpe/
Read more
The developers site: http://snippets.syabru.ch/nagios-jmx-plugin/
JMX4Perl How-to: How to monitor your application server with op5 Monitor and JMX4Perl
JMX on wikipedia: http://en.wikipedia.org/wiki/JMX
OP5 Monitor: Open Source Network Monitoring
OP5 is the preferred Open Source Networking & Server Monitoring tool for large multi-national companies in over 60 markets. If you would like to experience OP5 Monitor you can get started here, alternatively, if you prefer to get more hands on you can Download OP5 Monitor for free.
-
Tags:
- jmx
- jboss
- check_jmx
- java
Comments
0 comments
Please sign in to leave a comment.