Home > LinuxCommands, Nagios, plugins > How to monitor J2EE applications

How to monitor J2EE applications

October 26th, 2010 Leave a comment Go to comments

How to monitor J2EE applications

I found a cool JMX plugin that is does just that.
In the example I am doing for Glassfish but I believe it can be done
for Weblogic or Tomcat as well.

I found quite usefull to have JConsole open so I can find out what parameters.
How to install JConsole,
1. download and install NetBeans
2. download and install Java JDK
Open the NetBeans>Tools>Plugins JConsole

The trick is to know the JMX url when glassfish is started it shows exactly that.
It should look something like:

The plugins needed are available here
To install it
# wget http://xoroz.com/files/nagios-jmx-plugin.zip
# unzip nagios-jmx-plugin.zip
# cd nagios-jmx-plugin-1.2.0/
# cp check* /usr/local/nagios/libexec/
# chmod +x /usr/local/nagios/libexec/check_j*

Remember you will also need to have Java JRE on the nagios server or run the plugin remotely.
To install run:
# yum install java-1.6.0-openjdk

Doing it remotely I noticed that it was not outputing the perfdata information needed to graph the output.
So i Had to install Java on my nagios server.

To monitor via JMX:

“Heap Memory Use”
./check_jmx -U service:jmx:rmi:///jndi/rmi:// -O java.lang:type=Memory -A HeapMemoryUsage -K used –username admin –password <PASS> -w 180000000 -c 250000000

“Live Threads”
./check_jmx -U service:jmx:rmi:///jndi/rmi:// -O java.lang:type=Threading -A ThreadCount -K value –username admin –password <PASS> -w 190 -c 250

I also monitor de wdsl webservices if they are responding correctly by doing a check_http.

  1. Youcef
    February 9th, 2011 at 14:04 | #1

    Hi Felipe,

    I found this plugin http://labs.consol.de/jmx4perl/ that works with two parts :
    – an agent as a web application
    – a Nagios plugin
    The agent and the plugin communicate through a JSON format.

    • February 17th, 2011 at 16:33 | #2

      Thanks, I will check it out.
      I have been using JRockit Mission Control, quite nice!


  2. Jack
    May 8th, 2012 at 12:30 | #3

    Hi Felipe,

    Many thanks for your attention.

    I can monitor GlassFish with check_jmx4perl on OMD. Is it possible to use check_jmx4perl on Centreon? I’ve tried to do this carefully but got null in status information. Your suggestion is eagerly awaited and much appreciated.


  1. No trackbacks yet.