Version 9

    JBoss Nagios MBean


    The JBoss Nagios MBean opens a port on your server for a simple Nagios plugin to connect to. It provides the ability to monitor any JMX attribute, use alarm ranges, calculate deltas on counters and even monitor singletons in a cluster.


    Both, the JBoss Nagios MBean and the Nagios plugin can be obtained from the jboss2nagios project.



    JBoss Nagios Plugin



    The JBoss Nagios Plugin is a simple bash script that uses Twiddle to read targeted numerical JMX attributes such as connections in use, thread counts or JVM heap sizes.



    • Copy the attached script to your Nagios plugin directory. (RPM installs put it here: /usr/lib/nagios/plugins)

    • Issue a chmod 755 check_jbossjmx to make the file executable.

    • Add the following entry into the nagios


     # 'check_jbossjmx' command definition 
    define command{ 
            command_name    check_jbossjmx 
            command_line    /usr/lib/nagios/plugins/check_jbossjmx $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ 


    • Now implement a service check for a server. (Note that this implementation assumes JNDI listening on port 1099). Example:

    define service{ 
            use                             generic-service         ; Name of service template to use 
            host_name                       MY_JBOSS_SERVER 
            service_description             CHECK_ORACLE_POOL_SIZE 
            is_volatile                     0 
            check_period                    24x7 
            max_check_attempts              3 
            normal_check_interval           5 
            retry_check_interval            1 
            passive_checks_enabled          0 
            contact_groups                  OpsGroup 
            notification_interval           120 
            notification_period             24x7 
            notification_options            c,r,w 
            check_command                   check_jbossjmx!3!"jboss.jca:name=ORACLEDSN,service=ManagedConnectionPool"!InUseConnectionCount!20!50 


    This example will use JBoss 3's twiddle to check the connections in use on the app server. If the count is 50 or greater, it will generate a critical alert. If the count is 20 or greater, it will generate a warning alert.





    There are three settings you must configure in the checkjbossjmx_ script:

    1. JAVA_HOME:Set this to the Java Home of the JVM you want to use.

    2. JBOSS4_HOME: Set this to the JBossHome of a JBoss4 installation. Twiddle will be located as $JBOSS4_HOME/bin/

    3. JBOSS3_HOME: Set this to the JBossHome of a JBoss3 installation. Twiddle will be located as $JBOSS3_HOME/bin/


    Note that you only have JBoss 3 or only JBoss 4 servers, you do not need to configure both.


    The parameters to the plugin can be viewed by invoking check_jbossjmx --help.


    The parameters are as follows:


    1. The JBoss IP Address. (If the JNDI port is not 1099, there is an additional bit of poking around you need to do)

    2. The JBoss version. 3 or 4

    3. The full object name of the target MBean.

    4. The attribute name

    5. The warning threshhold

    6. The critical threshhold