Monitoring Apache HTTPd

After you install the Instana host agent, Apache HTTPd sensor is automatically installed, but you need to configure Apache HTTPd sensor as outlined in this topic. Then, you can view metrics that are related to Apache HTTPd in the Instana UI.

Supported information

Supported operating systems

The supported operating systems of Apache HTTPd sensor are consistent with host agents requirements, which can be checked in the Supported operating systems section of each host agent, such as Supported operating systems for Unix.

Supported Apache HTTPd versions and platforms

Apache HTTPd sensor and Apache HTTPd tracing have different version and platform requirements. For more information, see Supported Apache HTTPd versions and platforms.

Configuring

The HTTPd server main configuration file is at /etc/apache2/apache2.conf, /etc/httpd/conf/httpd.conf, or /etc/apache2/httpd.conf. The exact location of the configuration file that is used can be found:

  • In the process arguments: -d specifies the root directory and -f the config file.
  • In the apachectl -V output: HTTPD_ROOT= and SERVER_CONFIG_FILE=.

Debian users apply the changes in the dedicated status module’s configuration file, which is at /etc/apache2/mods-enabled/status.conf, instead of the main HTTPd configuration file.

You need to do the following changes in your HTTPd configuration file:

  • Enable the server status a HTTPd status page at the location /server-status.
  • Load the status_module (mod_status) to view Apache web server metrics.
  • View the detailed metrics for Traffic, Traffic per Request and CPU by enabling the ExtendedStatus.
<Location /server-status>
    SetHandler server-status
</Location>
LoadModule status_module lib/httpd/modules/mod_status.so
ExtendedStatus On

Place the server-status configuration at the beginning of your HTTPd configuration file.

You can check your configuration file for errors with the following command:

apachectl configtest

Restart to apply the changes without interrupting live connections ( apachectl -k graceful or service apache2 graceful).

The Instana sensor automatically picks up the configuration from HTTPd, there is no need to restart the agent. As a result, you can choose any location for the status page. Redirects are not followed for performance reasons.

If the status URL is protected, you need to provide basic authentication credentials in the agent configuration file <agent_install_dir>/etc/instana/configuration.yml:

com.instana.plugin.httpd:
  user: ''
  password: ''

Viewing metrics

To view the metrics, complete the following steps:

  1. In the sidebar of the Instana UI, select Infrastructure.
  2. Click a specific monitored host.

Then, you can see a host dashboard with all the collected metrics and monitored processes.

Configuration data

  • Process ID
  • Apache server version
  • Architecture
  • Start or up time
  • Workers limit
  • MPM
  • Ports
  • Loaded modules

Performance metrics

Metric Description
Requests Number of times the Apache server is accessed
Traffic Number of kBytes served
Busy workers Number of busy worker threads and processes
Connections count Number of total connections (only with Events MPM and Apache 2.3)
Async Writing Number of async connections in writing state (only with Events MPM and Apache 2.3)
Async Keep-alive Number of async connections in keep-alive state (only with Events MPM and Apache 2.3)
Async Closing Number of async connections in closing state (only with Events MPM and Apache 2.3)
Workers Waiting, Starting, Reading, Writing, Keepalive, Dns, Closing, Logging, Graceful, Idle
CPU Load The current CPU of the Apache server, as a percentage
Traffic per Request Bytes transferred per request

Health signatures

For each sensor, there is a curated knowledgebase of health signatures that are evaluated continuously against the incoming metrics and are used to raise issues or incidents, which depend on user impact.

Built-in events trigger issues or incidents based on failing health signatures on entities, and custom events trigger issues or incidents based on the thresholds of an individual metric of any entity.

For information about built-in events for the Apache HTTPd sensor, see Built-in events reference.

Tracing

This section describes how to install and configure Apache HTTPd tracing.

Prerequisites

Install Visual C++ Redistributable Packages for Visual Studio 2015-2022 before enable HTTPd tracing on Windows.

Ensure to install XL C/C++ Runtime for AIX 16.1.0 Fix Pack 7 or later versions on AIX 7.2, which includes the file set libc++.rte, before you enable HTTPd tracing.

You can verify the installation of the file set libc++.rte by using the following command:

lslpp -l |grep libc++.rte

Installing

The HTTPd tracing is disabled by default. When HTTPd tracing is enabled as described in Enable Tracing, the HTTPd Tracing Module is automatically downloaded when the HTTPd sensor is enabled. The tracing configuration is located at <agent_install_dir>/etc/instana/configuration.yaml, and the current version of the Instana agent contains an example of the available configuration settings.

Manual Installation

If the HTTPd server is running with limited read-only privileges in a containerized environment, the automatic installation of HTTPd Tracing Module does not work in such situation. You can manually install HTTPd Tracing Module in following steps:

  1. Get the right modules for your HTTP Server version.
  2. Copy the modules to your HTTP Server modules folder.
  3. Load the modules in your HTTPd configuration file.
Download the Modules

The download links for the modules for the supported HTTP server versions are available on the HTTPd Tracing Modules page.

Copy the Modules

The two modules that are downloaded in the previous step need to be placed in a folder that contains other HTTP modules, and must be given related file permissions. For module version 1.0.7 or lower, the file tracelibrary_x86_64-1.0.7.so needs to be renamed to tracelibrary.so.

Load the Modules

Create a file named instana_tracing.conf in the same location of the HTTPd configuration file (for example /etc/httpd/conf/httpd.conf). The file content might look like as:

LoadModule dem_module /usr/lib64/httpd/modules/mod_dem_x86_64-1.0.8.so

Then, add a line into the HTTPd configuration file to include the file instana_tracing.conf.

Include /etc/httpd/conf/instana_tracing.conf

Configuring

The available HTTPd tracing configuration settings in the configuration.yaml file of the Instana agent are listed:

# Apache Httpd
#com.instana.plugin.httpd:
#  tracing:
#    # Enabling tracing will automatically download the HTTPd Tracing module and
#    # load it in your Apache configuration file. You will need to manually restart
#    # Apache HTTP Server unless you specify a restart script in notificationScript
#    # or enable autoRestart. Disabling tracing will not remove the HTTPd Tracing module.
#    # It will only remove the tracing module config from the Apache configuration file.
#    enabled: false
#    # Pins the HTTPd Tracing module to download and install to a specific version.
#    # This can be used to rollback to previous versions of the module or to test
#    # beta versions (when asked to do so). Expects the version to be given as
#    # major.minor.patch format, e.g. 1.0.0
#    pinModuleVersion: x.y.z
#    # The absolute path to the script to trigger whenever the sensor installed
#    # a different version of the HTTPd Tracing module than is currently installed.
#    # Works for upgrades and downgrades. Default is empty.
#    notificationScript: /path/to/restart_apache.sh
#    # Enabling auto-restart will let the sensor attempt a graceful restart of your
#    # Apache HTTP Server to load the updated HTTPd Tracing module into memory.
#    # If you specify a notificationScript, then the sensor will ignore autoRestart setting
#    # unless the execution of.notificationScript failed.
#    autoRestart: false

Enable Tracing

Open <agent_install_dir>/etc/instana/configuration.yaml with a text editor. The entries are similar in nature:

#com.instana.plugin.httpd:
#  tracing:
#    enabled: false

Uncommenting out these lines and change enabled: false to enabled: true.

com.instana.plugin.httpd:
  tracing:
    enabled: true

If Automatic Restart is not configured, you need to manually restart HTTP Server to load the HTTPd Tracing Module into memory.

Disable Tracing

Open <agent_install_dir>/etc/instana/configuration.yaml with a text editor. Change enabled: true to enabled: false. Note tracing is disabled by default, so commenting this line achieves the same. After the change, entries should look like the following code:

com.instana.plugin.httpd:
  tracing:
    enabled: false

If Automatic Restart is not configured, you need to manually restart HTTP Server to unload the HTTPd Tracing Module from memory.

Version Pinning

The HTTPd Tracing module to download and install can be pinned to a specific version. If the line pinModuleVersion: x.y.z is commented, the current version of HTTPd Tracing Module is downloaded and installed.

Replace x.y.z with the specified module version in line pinModuleVersion: x.y.z in <agent_install_dir>/etc/instana/configuration.yaml. After the change, entries should look like the following yaml code:

com.instana.plugin.httpd:
  tracing:
    enabled: true
    pinModuleVersion: 1.0.8

If the HTTPd Tracing Modules are downloaded and installed by manual, the value of pinModuleVersion configuration should be specified to the version of the downloaded modules.

Automatic Restart

When tracing is enabled as in Enable Tracing, the HTTPd sensor automatically downloads and installs the appropriate HTTPd Tracing Module for your HTTP Server setup. In addition, the sensor might then attempt a graceful restart (apachectl -k graceful) of your HTTP Server. A graceful restart loads the HTTPd Tracing Module into memory without restarting the master process. So it works even when the process runs as PID 1 inside the container.

You can enable or disable automatic restart by configuring the autoRestart configuration setting in <agent_install_dir>/etc/instana/configuration.yaml. For instance, the following setting enables automatic restart:

com.instana.plugin.httpd:
  tracing:
    enabled: true
    autoRestart: true

You can also change how the HTTPd sensor attempts to restart your HTTP Server environment through the notificationScript configuration setting. The setting takes an absolute path to an executable shell script. If your HTTP Server runs inside a container, it is the absolute path in the container. This script gets triggered whenever the sensor installed a different version of the HTTPd Tracing module than is installed. When this script is configured and ran successfully, it overrides the default mechanism for automatic restart.

Note if the HTTPd Tracing Modules are downloaded and installed by manual, the automatic restart should be disabled in the autoRestart configuration setting and comment notificationScript configuration setting. You need to manually restart HTTP Server to load or unload the HTTPd Tracing Module.

Removing HTTPd Tracing Module

HTTPd Tracing Module might be removed manually in following steps:

  1. Locate instana_tracing.conf in the same location of the HTTPd configuration file (for example /etc/httpd/conf/httpd.conf). Get the absolute path of the HTTPd Tracing Module from the content of instana_tracing.conf. For instance, the file content might look like the following code:

    LoadModule dem_module /usr/lib64/httpd/modules/mod_dem_x86_64-1.0.8.so
    

    Then, the HTTPd Tracing Module is at /usr/lib64/httpd/modules/mod_dem_x86_64-1.0.8.so.

  2. Disable HTTPd Tracing as in Disable Tracing.

  3. Remove the HTTPd Tracing Module mod_dem_[arch]-[version].so (for example, /usr/lib64/httpd/modules/mod_dem_x86_64-1.0.8.so) and tracelibrary_[arch]-[version].so in the same location (for example, /usr/lib64/httpd/modules/tracelibrary_x86_64-1.0.8.so).