On this page:

Related pages:

To monitor the performance of your Apache HTTP Server, IBM HTTP Server (IHS) or Oracle HTTP Server, install the AppDynamics Apache Agent on the servers where you run Apache, IHS or OHS. The agent instruments the Apache server and sends performance data to a Java proxy, which in turn sends data to the AppDynamics Controller.

If you are using the Apache Monitoring Extension with the Standalone Machine Agent, you can continue to use it. You may need to restart the Standalone Machine agent after installing the Apache Agent.

Before Starting

Ensure that the web server version and operating system are supported. See Supported Apache Web Servers for more information. 

Also verify the following requirements on the machine on which you are installing the agent: 

Download and Install the Apache Agent

To guarantee performance and stability, you should install one agent for each Apache instance. Do not exceed two Apache instances per agent.

  1. Download the Apache Agent from the Getting Started wizard or https://www.appdynamics.com/download
  2. Extract the agent to /opt.

    tar -xzvf ./appdynamics-sdk-native.<version>.tar.gz -C /opt

    The agent installs to /opt/appdynamics-sdk-native. This is the <agent_install_directory>. If you are installing multiple agents, you must create separate install directories for each agent.

  3. Grant the Apache, IHS or OHS owner read and write permissions to the logs directory: <agent_install_directory>/logs.
  4. Run install.sh. This script installs the agent proxy. 

  5. For an agent to monitor your Apache instance, you must launch the proxy. If you are monitoring multiple Apache instances, we recommend that you manually launch each proxy, and set AppDynamicsLaunchProxy (see below) to NO for every Apache instance. 

    The next step is to create the agent configuration file and configure the agent.

Configure the Apache Agent

  1. Create a configuration file for the AppDynamics Apache Web Server agent, such as appdynamics_agent.conf, in the Apache, IHS, or OHS configuration directory. For example:

    touch /etc/<path_to_webserver_dir>/conf/appdynamics_agent.conf
  2. In the appdynamics_agent.conf file, configure the following settings. If you have multiple agents installed, you must edit the appdynamics_agent.conf file for each agent, specifying which directory the agent load modules are located. Ensure that each Apache instance references a different appdynamics_agent.conf file, and that each file specifies a different agent install directory.
#Load the AppDynamics SDK.
LoadFile /opt/appdynamics-sdk-native/sdk_lib/lib/libappdynamics_native_sdk.so
#Load the Apache Agent. In this example for Apache 2.4
LoadModule appdynamics_module /opt/appdynamics-sdk-native/WebServerAgent/Apache/libmod_appdynamics.so

AppDynamicsEnabled On

#AppDynamics Controller connection.
AppDynamicsControllerHost mycontroller.saas.appdynamics.com
AppDynamicsControllerPort 80
AppDynamicsControllerSSL OFF

#Account credentials
AppDynamicsAccountName MyCompany
AppDynamicsAccessKey zd8yjh5yuy5k

#Configure Controller connection through an HTTP proxy server.
#AppDynamicsProxyHost <proxy host>
#AppDynamicsProxyPort <proxy port>

#Business application, tier, node
AppDynamicsApplication MyApache2App
AppDynamicsTier Apache2
AppDynamicsNode Apache2_1

Launch the Proxy

To launch the proxy manually, run runSDKProxy.sh using the user ID of the Apache worker threads.

nohup <agent_install_directory>/runSDKProxy.sh >>/dev/null 2><agent_install_dir>/logs/proxy.out &

It is recommended that you create a Unix System Service that automatically starts the proxy at system startup.

Additional Directives

Under special circumstances, you may need to set the optional directives below. Do not set these directives unless instructed by AppDynamics support.

Configure the Apache Server for AppDynamics

  1. Add an include for the AppDynamics Apache Agent configuration to the server configuration. Ensure that the AppDynamics module is loaded after any modules you want to be instrumented. Any modules loaded after the AppDynamics agent are excluded from instrumentation and monitoring. For example, add the following as the last line in the httpd.conf (on Ubuntu and Debian, this file is called apache2.conf):

    #Include AppDynamics Apache Agent Configuration
    Include conf/appdynamics_agent.conf

    If you are running multiple instances of the web server, modify the .conf Include path to match the configuration file name for that instance. For example:

    #Include AppDynamics Apache Agent Configuration.
    Include conf/appdynamics_agent1.conf

    If you are setting values for Apache thread limits (e.g. ServerLimit, ThreadsPerChild, ThreadLimit), ensure that the concurrent thread limit does not exceed 4095.


  2. Restart the web server. For example, for Apache on CentOS:

    apachectl restart
  3. Apply load to your web server to activate instrumentation.

The AppDynamics Apache Agent automatically detects the incoming HTTP calls as business transactions. It detects loaded modules as backends. Log in to the AppDynamics Controller to begin monitoring.

Map Virtual Hosts to AppDynamics Tiers

By configuring virtual hosts, Apache Web Server administrators can have a single Apache Web Server instance act as the entry point for what appears to be different websites from the end user's perspective.

In the AppDynamics application model, it will usually make sense to represent each virtual host configured in an Apache Web Server as its own tier. This tends to better represent the logical model of the environment and reduces the likelihood of quickly exhausting tier business transaction limits for an Apache Web Server that proxies a large application environment.

To associate different virtual hosts with different tiers, add the AppDynamicsApplicationContext directive to the virtual host configuration, supplying the application, tier and node name as arguments, as follows:

AppDynamicsApplicationContext <application> <tier> <node>  

For example:

Listen 80
<VirtualHost *:80>
    DocumentRoot "/www/example1"
    ServerName site1.example.com
    AppDynamicsApplicationContext MyApp site1.example.com:80 node01

<VirtualHost *:80>
    DocumentRoot "/www/example2"
    ServerName site2.example.org
    AppDynamicsApplicationContext MyApp site2.example.org:80 node01

In the example above, the tier name is a combination of the virtual machine's ServerName and port number. You are not required to include the ServerName and port number in the tier name, but they can be useful for identifying which virtual machines are creating business transactions. We recommend using a tier name that best represents the virtual machine's purpose.

The Apache Web Server Agent associates incoming requests to the AppDynamics context based upon the virtual host server and port in the request.

Note that instead of using virtual hosts to multi-host from Apache, an administrator may run multiple instances of the Apache Web Server with a distinct httpd.conf file (on Ubuntu and Debian, this file is called apache2.conf) for each instance. In this case, you would instrument the Apache Web Server by creating an AppDynamics agent configuration file (Configure the Apache Agent) for each instance, and include each configuration file in the httpd.conf file of the corresponding instance.