On this page:
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.
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:
- Perform the installation under the same user and group that Apache is using when spawning worker processes and threads.
- Ensure that the ulimit setting for open file descriptors is set such that your process (or any others) does not exceed it. At a minimum you need two times more than the maximum number of simultaneously active threads created by the Apache Web Server during heavy loads. AppDynamics recommend setting the ulimit open file descriptors to 10000.
- Ensure that you do not configure more than 4032 concurrent threads.
- Check for modules with dependencies on libstdc++.so.5. see Special Considerations for Apache Web Servers with libstdc++.so.5 Modules. This is most common with IHS and OHS.
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.
- Download the Apache Agent from the Getting Started wizard or https://www.appdynamics.com/download.
Extract the agent to /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.
- Grant the Apache, IHS or OHS owner read and write permissions to the logs directory: <agent_install_directory>/logs.
Run install.sh. This script installs the agent proxy.
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
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:
- 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.
LoadFile: loads the AppDynamics Agent SDK shared library. Assuming the agent is installed in /opt, the setting would be
LoadModule: loads the AppDynamics Apache Agent shared library. The correct module is libmod_appdynamics.so for Apache 2.4 and libmod_appdynamics22.so for Apache 2.2. Required. IHS and OHS require the Apache 2.2 module.
Apache 2.4 example:
Apache 2.2 example:
AppDynamicsEnabled: Must be included and set to ON for web server monitoring to be enabled. Otherwise, monitoring is disabled by default. For example:
To disable monitoring, set to OFF or remove the AppDynamics module include statement (see Configure the Apache Server for AppDynamics) from the Apache configuration file.
AppDynamicsControllerHost: host name or IP address of the AppDynamics controller to connect to. Required.
AppDynamicsControllerPort: Controller HTTP(S) port. For SaaS, use 443 for HTTPS or 80 for HTTP. For on-premises, HTTP defaults to 8090 and HTTPS defaults to 8181. Optional. Configure if you do not want to use these defaults. If you are using HTTPS, the SSL setting (below) must also be set.
AppDynamicsControllerSSL: Set to connect to the controller over SSL. Default is OFF. Set to ON to enable SSL connection and also set the AppDynamicsControllerPort to an HTTPS port.
- AppDynamicsAccountName: AppDynamics account name. For on-premises controllers, find your credentials under Settings > License in the Controller. For SaaS controllers, AppDynamics provides your credentials in your Welcome email. Required.
- AppDynamicsAccessKey: AppDynamics account access key. For on-premises controllers, find your credentials under Settings > License in the Controller. For SaaS controllers, AppDynamics provides your credentials in your Welcome email. Required.
AppDynamicsProxyHost: proxy server host name or IP address. Optional. Use if the agent connects to the Controller through a HTTP proxy server.
- AppDynamicsProxyport: proxy server port. Optional. Use if the agent connects to the Controller through a HTTP proxy server
AppDynamicsApplication: AppDynamics application name. See Overview of Application Monitoring for more information. Required.
AppDynamicsTier: AppDynamics tier name. See Overview of Application Monitoring for more information. Required.
AppDynamicsNode: AppDynamics node name. See Overview of Application Monitoring for more information. Required.
Launch the Proxy
To launch the proxy manually, run runSDKProxy.sh using the user ID of the Apache worker threads.
It is recommended that you create a Unix System Service that automatically starts the proxy at system startup.
Under special circumstances, you may need to set the optional directives below. Do not set these directives unless instructed by AppDynamics support.
AppDynamicsResolveBackends: Controls the way Apache module backends appear in the Controller UI. If ON, metrics for Apache modules are shown as part of downstream tiers or backends. Module backends do not appear on flow maps.
If OFF, Apache module backends appear in the flow maps with their own metrics. See "Apache Modules" on Install the Apache Agent...
Defaults to ON. Optional.
AppDynamicsTraceAsError: If ON, trace points are written as errors to the Apache logs, by default error_log. Default is OFF. Optional.
- AppDynamicsReportAllInstrumentedModules: If OFF, the agent reports only modules that occur during the HANDLER stage of Apache request processing. If ON, the agent reports modules during all stages of Apache request processing. The default is OFF.
AppDynamicsLaunchProxy: If ON, the agent launches the proxy automatically when on startup. If OFF, you need to manually launch the proxy. If your system uses any command to do a graceful restart of Apache (such as log rotate), or if your system encounters heavy loads, you should set this property to OFF. The default is OFF.
You may want to launch the proxy manually for debugging, for example to set a different proxy root directory or runtime directory or to output additional debugging information.
AppDynamicsProxyCommDir: Path to the directory containing the domain control socket, which the agent uses to start an AppDynamics node. Defaults to <agent_install_directory>/logs/appd-sdk. If you modify this setting, make sure that the directory path does not exceed 107 characters, which is the linux limit to the socket file name size. If the directory path is too long, you will get an error message when the agent attempts to start.
Configure the Apache Server for AppDynamics
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):
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:
If you are setting values for Apache thread limits (e.g. ServerLimit, ThreadsPerChild, ThreadLimit), ensure that the concurrent thread limit does not exceed 4095.
Restart the web server. For example, for Apache on CentOS:
- 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>
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.