---
title: "How to monitor Jboss with check_jmx"
description: "Monitoring JBoss with check_jmx involves using the plugin to track MBean attributes exposed via JMX on the application server. The process requires enabling the JMX agent, installing the check_jmx plugin, and configuring check commands and services within OP5 Monitor."
url: "https://docs.itrsgroup.com/docs/faq/op5/360020257653-op5-monitor-how-to-monitor-jboss-with-check-jmx/index.html"
---
## Introduction

This how-to will show how to monitor an installation of JBoss with OP5 Monitor and the plugin [check\_jmx](https://github.com/mcapra/nagios-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) which 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 provides MBeans specific for the application server in question.

Standard JMX using RMI is no longer available in JBoss 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 needs to be enabled on 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 server's manual on 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 instance, you can install java via yum from our repositories: **`yum install java-1.7.0-openjdk`**

More information regarding Java installation and its versions can be found through the CentOS community: <http://wiki.centos.org/HowTos/JavaOnCentOS>.

**Please note, beginning in OP5 Monitor version 9.x, the check\_jmx plugin is no longer included but can be imported as a [custom plugin](https://docs.itrsgroup.com/docs/op5-monitor/current/topics/plugins/custom-plugins.html#Overview_..12).**

## Usage

The plugin consists 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 the command-line to verify that they work 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 suit 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 developer's 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: [Additional server and software setup.](https://docs.itrsgroup.com/docs/op5-monitor/current/topics/install/additional-setup.html#Set_up_a_Unix_NRPE_agent)

## Read more

The developer's site: [http://snippets.syabru.ch/nagios-jmx-plugin/](http://snippets.syabru.ch/nagios-jmx-plugin/ "check_jmx")


