How to Monitor JBoss Application Server Using eG Enterprise?

A JBoss application server (version 4.0 and 4.2.3) can be monitored in an agent-based or an agentless manner using eG Enterprise. Before attempting JBoss monitoring, the JBoss application server should be configured to work with the eG agent. The following sections describe how to configure a JBoss application server to work with eG agent.

Configuring the JBoss server to work with the eG Agent

To monitor the JBoss server, eG requires administrators to deploy two specialized components on the target server. These components are, the eG MBean Service component, and the eG Web Component. In order to enable the eG agents to extract statistics from the JBoss server, the above-mentioned components need to be deployed on the JBoss server. To achieve this, do the following:

  1. To deploy the eG MBean Service component on a JBoss server (prior to JBoss v4.2), a file named EgJBossAgent.sar will have to be copied from the <EG_INSTALL_DIR>\lib directory of the eG agent (running Windows; on Unix, this will be the /opt/egurkha/lib directory) to the <JBOSS_INSTALL_DIR>\server\<JBOSS_APPLICATION_SERVER_INSTANCE>\deploy directory on the JBoss server to be monitored. For example, if the application server instance of the target JBoss server is 'default', and the server is installed in the 'D:\JBoss' directory, then the file will have to be copied to the D:\JBoss\server\default\deploy directory.
  2. Likewise, to deploy the eG MBean Service component on a JBoss server of v4.2 (and above), a file named EgJBossAgent42.sar will first have to be copied from the <EG_INSTALL_DIR>\lib directory of the eG agent host (running Windows; on Unix, this will be the /opt/egurkha/lib directory) to any temporary folder on the same host. Then, rename the file to EgJbossAgent.sar, and then copy it to the <JBOSS_INSTALL_DIR>\server\<JBOSS_APPLICATION_SERVER_INSTANCE>\deploy directory on the JBoss server to be monitored.
  3. For the eG Web component to be deployed on the JBoss server, you will have to copy a file named egjboss.war to the server. This file will be available in the <EG_INSTALL_DIR>\lib directory in Windows installations of the eG agent. On Unix, these files will be available in the /opt/egurkha/lib directory.
  4. Next, proceed to restart the server. Prior to this, ensure that the server can be accessed using its IP address. This is because, by default, Jboss is bound to the local host. This implies that, by default, you will not be able to pull out metrics from the JBoss server or access the resources of the server using its IP address. This default setting could cause the eG tests to fail. In order to avoid this, you will have to ensure that the JBoss server is accessible via the IP address. For that, to start/restart the server, run the following command at the command prompt of the server:

    run.bat -b ip

    Note:

    To be effectively monitored by the eG agent, the JBoss server should be of  version 4.0 or 4.2.3, and should be executing on JDK 1.5 or higher.

Configuring the eG Agent to Collect JVM-related Metrics from the JBoss server Ver. 4.0

The jvm layer of the JBoss monitoring model is associated with tests that report critical statistics related to the JBoss server’s JVM. These statistics typically reveal the following:

  • The count of classes loaded/unloaded (Java Classes test)
  • JVM thread usage (JVM Threads test)
  • CPU and memory usage of the JVM (JVM Cpu Usage test and JVM Memory Usage test)
  • The effectiveness of the JVM’s garbage collection activity  (JVM Garbage Collections test)
  • The uptime of the JVM (JVM Uptime test)
  • Whether JMX is currently enabled/disabled on the target WebLogic server (JMX Connection to JVM test)
  • The count and status of file descriptors (JVM File Descriptors test)

These tests connect to the JRE used by the JBoss application server to pull out the above-mentioned metrics. To enable the tests to collect metrics from the JRE, the eG agent executing these tests should be configured to use one of the following methodologies:

  • JMX (Java Management Extensions)
  • SNMP (Simple Network Management Protocol)

Since both JMX and SNMP support are available for JRE 1.5 and above only, these tests will work only if the JBoss server being monitored runs JRE 1.5 and above.

If the target JBoss server indeed uses JRE 1.5 (or above), then, you can proceed to use either JMX or SNMP for connecting to the JRE of the target and pulling out the desired metrics.

If you choose to use JMX for metrics, then the following broad steps need to be followed:

  1. First, determine whether the JMX requires no authentication at all, or requires authentication (but no security)
  2. If JMX does not require authentication, follow the steps below:

    • Login to the target JBoss server.
    • Edit the management.properties file that is used by the JRE of the target JBoss server, and configure the following in it:
    • The JMX remote port
    • Whether JMX is SSL-enabled or not
    • Whether JMX requires authentication or not
    • To know how to configure these, refer to the Monitoring Java Applications document.
    • Save the file.

    Note:

    To know how to enable SNMP support for the JRE, refer to the Monitoring Java Applications document.

  3. If the JMX requires authentication (but no security), follow the steps below:

    • Login to the target JBoss server. If the server is executing on a Windows host, then, login to the host as a local/domain administrator.
    • Next, copy the jmxremote.password.template file in the <JAVA_HOME>\jre\lib\management folder to any other location on the host, rename it as as jmxremote.password, and then, copy it back to the <JAVA_HOME>\jre\lib\management folder.
    • Next, edit the jmxremote.password file and the jmxremote.access file to create a user with read-write access to the JMX. To know how to create such a user, refer to Monitoring Java Applications document.
    • Then, proceed to make the jmxremote.password file secure by granting a single user “full access” to that file. To know how to achieve this, refer to the Monitoring Java Applications document.
    • Edit the management.properties file that is used by the JRE of the target JBoss server, and configure the following in it:

      • The JMX remote port
      • Whether JMX is SSL-enabled or not
      • Whether JMX requires authentication or not
      • The full path to the jmxremote.access file
      • The full path to the jmxremote.password file
      • To know how to configure these, refer to the Monitoring Java Applications document.
      • Then, save the file.
      • Then, edit the <JBOSS_HOME>\bin\run.batfile.
      • Add the following line in it:

        set JAVA_OPTS=-Dcom.sun.management.config.file=<<Path to management.properties file used by the JRE of the target JBoss server>

      • Finally, restart the server.

Then, proceed to enable the JVM-related tests, and configure them using the instructions provided in the Monitoring Java Application Servers document. To enable one/more tests, go to the ENABLE / DISABLE TESTS page using the menu sequence : Agents -> Tests -> Enable/Disable, pick JBoss as the Component type, Performance as the Test type, choose the tests from the DISABLED TESTS list, and click on the >> button to move the tests to the ENABLED TESTS list. Finally, click the Update button.

Once you have configured the JBoss application server to work with the eG agent, manage the JBoss application server component using eG administrative interface. The procedure for achieving this has been explained in Managing the JBoss Application server.