Chapter 2. Managed Servers

2.1. Configuring Apache for Monitoring
2.1.1. Configuring the Response Time Module for Apache 1.3
2.1.2. Configuring the Response Time Module for Apache 2.x
2.1.3. Configuring the Apache SNMP Module
2.2. Apache HTTP Server
2.2.1. Apache Virtual Host Service
2.2.2. Mod JK Service
2.3. ESB Service
2.3.1. Deployment
2.3.2. Services
2.3.3. Gateways
2.3.4. Listeners
2.3.5. Actions
2.4. ESB 5 Service
2.4.1. Deployment
2.4.2. Services
2.4.3. Gateways
2.4.4. Listeners
2.4.5. Actions
2.5. Hibernate Statistics Service
2.5.1. Hibernate Entity Service
2.6. IIS Server
2.6.1. VHost Service
2.7. JBoss AS 4.x
2.7.1. ConnectionFactory Service
2.7.2. Datasource Service
2.7.3. EJB3 Entity Tree Cache Service
2.7.4. EJB3 Session Bean Service
2.7.5. Embedded Tomcat Server
2.7.6. Enterprise Application (EAR) Service
2.7.7. Entity EJB Service
2.7.8. JBossMessaging Service
2.7.9. JBossMQ Service
2.7.10. Message Driven EJB Service
2.7.11. Script Service
2.7.12. Stateful Session EJB Service
2.7.13. Stateless Session EJB Service
2.7.14. Web Application (WAR) Service
2.8. JBoss AS 5.x
2.8.1. EJB2 JAR Service
2.8.2. EJB2 Entity Bean (Embedded) Service
2.8.3. EJB2 Message-Driven Bean (Embedded) Service
2.8.4. EJB2 Stateful Session Bean (Embedded) Service
2.8.5. EJB2 Stateless Session Bean (Embedded) Service
2.8.6. EJB3 JAR Service
2.8.7. EJB3 Message-Driven Bean (Embedded) Service
2.8.8. EJB3 Stateful Session Bean (Embedded) Service
2.8.9. EJB3 Stateless Session Bean (Embedded) Service
2.8.10. Embedded EJB2 JAR Service
2.8.11. Embedded EJB3 JAR Service
2.8.12. Embedded Resource Adapter Archive (RAR) Service
2.8.13. Embedded Web Application (WAR) Service
2.8.14. Enterprise Application (EAR) Service
2.8.15. JBoss Messaging Service
2.8.16. JBoss Web Service
2.8.17. Local Tx Datasource Service
2.8.18. No Tx ConnectionFactory Service
2.8.19. No Tx Datasource Service
2.8.20. Resource Adapter Archive (RAR) Service
2.8.21. Script Service
2.8.22. Service Binding Manager Service
2.8.23. Tx ConnectionFactory Service
2.8.24. Web Application (WAR) Service
2.8.25. XA Datasource Service
2.9. JBossCacheSubsystem Server
2.9.1. JBossCache Service
2.10. JBoss Cache Service 3
2.10.1. Data Container Service
2.10.2. Interceptor Service
2.10.3. Lock Manager Service
2.10.4. RegionManager Service
2.10.5. RPC Manager Service
2.10.6. Transaction Table Service
2.10.7. Tx Interceptor Service
2.11. JMX Server
2.11.1. java.util.logging Service
2.11.2. Operating System Service
2.11.3. Threading Service
2.11.4. VM Class Loading System Service
2.11.5. VM Compilation System Service
2.11.6. VM Memory System Service
2.12. JMS Manager Service
2.12.1. JMS Connection Factory Service
2.12.2. JMS Queue Service
2.12.3. JMS Topic Service
2.13. Postgres Server
2.13.1. Database Service
2.13.2. User Service
2.14. RHQ Agent Server
2.14.1. Environment Setup Script Service
2.14.2. Java Service Wrapper Launcher Service
2.14.3. Launcher Script Service
2.14.4. Measurement Subsystem Service
2.14.5. Plugin Container Service
2.15. Tomcat Server
2.15.1. Tomcat Connector Service
2.15.2. Tomcat User Database Service
2.15.3. Tomcat Virtual Host Service

2.1. Configuring Apache for Monitoring

JBoss Operations Network uses SNMP to monitor an Apache server for things like availability. JBoss ON can also monitor URLs hosted by the Apache server and return response time metrics for each URL.
For JBoss Operations Network to gather metrics about the Apache web server or its URL, the appropriate module (SNMP or Response Time) must be configured in the Apache server. Both JBoss ON modules are Apache Dynamically Shared Object (DSO), so the general implementation for these modules is similar to deploying other Apache modules:
  1. Make sure the Apache server was compiled with DSO support.
  2. Compile and install the module.
  3. Configure the Apache server to use the module.
  4. Restart the Apache server.

2.1.1. Configuring the Response Time Module for Apache 1.3

To collect response time metrics for each URL for an Apache server, the Response Time module must be configured on that Apache server.

IMPORTANT

To use the Response Time module, the Apache server needs to have been compiled with shared object support. For Red Hat Enterprise Linux systems and EWS servers, this is enabled by default.
To verify that the Apache server was compiled with shared object support, use the apachectl -l command to list the compiled modules and look for the mod_so.c module:
[root@server ~]# apachectl -l
Compiled in modules:
  core.c
  prefork.c
  http_core.c
  mod_so.c
When compiling Apache from source, use the --enable-so option:
$ ./configure --enable-so
$ make install
  1. Download the Apache binaries from the JBoss ON UI.
    1. Log into the JBoss ON UI.
      https://server.example.com:7080
      
    2. In the Administration tab in the top menu, click the Downloads item.
    3. Scroll to Connector Downloads, and click the connector-apache.zip link to download the Apache connectors.
  2. Unzip the Apache connectors in a directory that is accessible to the JBoss ON agent.
    unzip connector-apache.zip
    
  3. Compile the Response Time module.

    NOTE

    apxs must be installed, and make must be installed and in the user PATH.
    cd apacheMOduleRoot/apache-rt/sources
    
    ./build_apache_module.sh 1.3 apache_install_directory/bin/apxs
    
  4. Then, install the Response Time module on the Apache server.
    cp apache1.3/.libs/mod_rt.so apache_install_directory/modules
    
  5. Open the httpd.conf file. For example, on Red Hat Enterprise Linux:
    vim apache_install_directory/conf/httpd.conf
    
  6. Enable the module in the Apache's httpd.conf file by appending this line to the end of the file:
    LoadModule  rt_module  modules/mod_rt.so
    
  7. Configure response time logging.
    To configure response time logging for the main Apache server, add the following line at the top level of the file:
    RTLog  logs/myhost.com80_rt.log
    
    To configure response time logging for a virtual host, add the following line within the <VirtualHost> block:
    RTLog  logs/myhost.com8080_rt.log
    
    Make sure the response time log file name is different for the main server and each virtual host. Consider using the the host and port from the ServerName directive be used to form the file name, such as host_port_rt.log.
  8. Restart the Apache server:
    apache_install_directory/bin/apachectl restart
    
  9. To confirm that the Response Time module was installed successfully, check that the response time log files configured in the RTLog directive now exist.

2.1.2. Configuring the Response Time Module for Apache 2.x

To collect response time metrics for each URL for an Apache server, the Response Time module must be configured on that Apache server.

IMPORTANT

To use the Response Time module, the Apache server needs to have been compiled with shared object support. For Red Hat Enterprise Linux systems and EWS servers, this is enabled by default.
To verify that the Apache server was compiled with shared object support, use the apachectl -l command to list the compiled modules and look for the mod_so.c module:
[root@server ~]# apachectl -l
Compiled in modules:
  core.c
  prefork.c
  http_core.c
  mod_so.c
When compiling Apache from source, on 2.0.x versions, use the --enable-so option:
$ ./configure --enable-so
$ make install
For Apache 2.2.x versions, use the --enable-module=so option:
$ ./configure --enable-module=so
$ make install
  1. Download the Apache binaries from the JBoss ON UI.
    1. Log into the JBoss ON UI.
      https://server.example.com:7080
      
    2. In the Administration tab in the top menu, click the Downloads item.
    3. Scroll to Connector Downloads, and click the connector-apache.zip link to download the Apache connectors.
  2. Unzip the Apache connectors.
    unzip connector-apache.zip
    
  3. Compile the Response Time module.

    NOTE

    apxs must be installed, and make must be installed and in the user PATH.
    cd apacheMOduleRoot/apache-rt/sources
    chmod +x build_apache_module.sh
    ./build_apache_module.sh 2.x apache_install_directory/bin/apxs
  4. Then, install the Response Time module on the Apache server. On Red Hat Enterprise Linux:
    cp apache2.x/.libs/mod_rt.so apache_install_directory/modules
    For Solaris:
    cp apache2.x/.libs/mod_rt.so APACHE_2.x_INSTALL_DIR/modules
    For Windows, run the following command:
    xcopy /e JON_AGENT_INSTALL_DIR\product_connectors\apache-rt\binaries \x86-winnt-apache2.0\* apache_install_directory
  5. Open the httpd.conf file. For example, on Red Hat Enterprise Linux:
    vim apache_install_directory/conf/httpd.conf
    
  6. Enable the module in the Apache's httpd.conf file by appending this line to the end of the file:
    LoadModule  rt_module  modules/mod_rt.so
    LogFormat  "%S"  rt_log
    
    When setting the log format, the variable %S has a capital S.
  7. To configure response time logging for the main Apache server, add the following line at the top level of the file:
    CustomLog  logs/myhost.com80_rt.log  rt_log
    
    
    To configure response time logging for a virtual host, add the following line somewhere within the <VirtualHost> block:
    CustomLog  logs/myhost.com8080_rt.log  rt_log
    
    
    Make sure the response time log file name is different for the main server and each virtual host. Consider using the the host and port from the ServerName directive be used to form the file name, such as host_port_rt.log.
  8. Restart the Apache server:
    apache_install_directory/bin/apachectl restart
    
  9. To confirm that the Response Time module was installed successfully, check that the response time log files configured via the CustomLog directive now exist.

2.1.3. Configuring the Apache SNMP Module

To discover an Apache server's virtual hosts and collect metrics for them, the SNMP module must be configured on that Apache server.
Apache 1.3, 2.0, and 2.2 are supported on Red Hat Enterprise Linux. Only Apache 2.0 is supported on Windows.

IMPORTANT

To use the Response Time module, the Apache server needs to have been compiled with shared object support. For Red Hat Enterprise Linux systems and EWS servers, this is enabled by default.
To verify that the Apache server was compiled with shared object support, use the apachectl -l command to list the compiled modules and look for the mod_so.c module:
[root@server ~]# apachectl -l
Compiled in modules:
  core.c
  prefork.c
  http_core.c
  mod_so.c
When compiling Apache from source, on 2.0.x versions, use the --enable-so option:
$ ./configure --enable-so
$ make install
For Apache 2.2.x versions, use the --enable-module=so option:
$ ./configure --enable-module=so
$ make install
  1. Download the Apache binaries from the JBoss ON UI.
    1. Log into the JBoss ON UI.
      https://server.example.com:7080
      
    2. In the Administration tab in the top menu, click the Downloads item.
    3. Scroll to Connector Downloads, and click the connector-apache.zip link to download the Apache connectors.
  2. Unzip the Apache connectors in a directory that is accessible to the JBoss ON agent.
    unzip connector-apache.zip
    
  3. Each Apache version and platform has its own package that contains the Apache-SNMP connectors. Unzip the Apache connectors in a directory that is accessible to the JBoss ON agent. Binaries are available for Red Hat Enterprise Linux 32-bit and 64-bit and Windows.
    For example, on Red Hat Enterprise Linux 32-bit:
    cd apacheModuleRoot/apache-snmp/binaries/
    tar xjvf snmp_module-x86-linux-apache#.tar.bz2
    
    # is the Apache server version number.

    NOTE

    Apache connectors can be compiled for other platforms, like Solaris, from the source files in apacheMOduleRoot/apache-snmp/sources. For example:
    cd JON_AGENT_INSTALL_DIR/product_connectors/apache-snmp/sources
    ./build_apache_snmp.sh APACHE_VERSION APACHE_2.x_INSTALL_DIR/bin/apxs
    To compile the Apache-SNMP connector, apxs, perl, make, and automake must all be installed and in user PATH.
  4. Install the module:
    cd apacheModuleRoot/apache-snmp/binaries/snmp_module_#
    cp module/* apache_install_directory/modules
    cp conf/* apache_install_directory/conf
    mkdir apache_install_directory/var
    
  5. Open the httpd.conf file. For example, on Red Hat Enterprise Linux:
    vim apache_install_directory/conf/httpd.conf
    
  6. Add lines for the Apache server to load the SNMP module. The lines are similar, but not identical, between Apache versions.
    For Apache 1.3 on Red Hat Enterprise Linux:
    LoadModule  snmp_agt_module  modules/libsnmp_agt.so
    AddModule  covalent-snmp-v13.c
    SNMPConf  conf
    SNMPVar  var
    
    For Apache 2.0 and 2.2 on Red Hat Enterprise Linux:
    LoadModule snmpcommon_module modules/libsnmpcommon.so
    LoadModule snmpagt_module modules/libsnmpmonagt.so
    		
    SNMPConf   conf
    SNMPVar    var
    
    For Apache 2.0 on Windows:
    xcopy /e JON_AGENT_INSTALL_DIR\product_connectors\apache-snmp\binaries\x86-winnt-apache2.0\* APACHE_2.0_INSTALL_DIR
  7. For Apache 2.0 and 2.2. Enable the module by adding these lines to the httpd.conf on both Red Hat Enterprise Linux and Windows:
    LoadModule snmpcommon_module modules/snmpcommon.so
    LoadModule snmpagt_module modules/snmpmonagt.so
    		
    SNMPConf   conf
    SNMPVar    var
    
  8. Make sure the main Apache configuration section, as well as each <VirtualHost> configuration block, contains a ServerName directive with a port. The SNMP module uses this directive to uniquely identify the main server and each virtual host, so each ServerName directive must contain a unique value. For example:
    ServerName main.example.com:80
    ...
    		
    <VirtualHost vhost1.example.com:80>
    ServerName vhost1.example.com:80
    ...
    </VirtualHost>
    
  9. To monitor more than one Apache instance on the same machine, make sure the agentaddress property in apache_install_directory/conf/snmpd.conf has a different value for each instance. See the snmpd.conf documentation for a description of this property's syntax.
  10. Restart the Apache server. For example:
    apache_installation_dir/bin/Apache -k restart
    
  11. Verify that the SNMP module was properly installed. If the module is loaded, then there will be lines referencing the SNMP module in the errors log:
    grep SNMP apache_installation_dir/logs/error_log
    
    [Wed Mar 19 09:54:34 2008] [notice] Apache/2.0.63 (Unix) CovalentSNMP/2.3.0 configured -- resuming normal operations
    [Wed Mar 19 09:54:35 2008] [notice] SNMP: CovalentSNMP/2.3.0 started (user '1000' - SNMP address '1610' - pid '26738')