Apache metrics

The OpenTelemetry Collector provides an integration with Apache to ingest metrics. The Collector fetches metrics from the configured path in the Apache receiver. From there the metrics are processed and exported to Cloud Observability.

To complete the integration, you will:

  • Configure Apache to report metrics to the OpenTelemetry Collector
  • Configure the Apache receiver for the Collector
  • Enable the integration by adding it to a pipeline

Prerequisites

  • Apache v2.4 or later
  • You’ve configured the Collector to export metric data to Cloud Observability.

Configure Apache reporting

Apache emits metrics using the mod_status module that provides an endpoint with information about the state of the server. To enable the status endpoint for Apache, load the mod_statusmodule into your httpd.conf file using the following directive::

1
LoadModule status_module modules/mod_status.so

By default, httpd.conf is used for configuring these parameters, but Apache also supports files. Depending on your setup, this module may need to go in another location.

Additionally, access to the server status endpoint is restricted and additional configuration is required to ensure the OpenTelemetry Collector can access the endpoint. Add the following location object to your httpd-info.conf file:

1
2
3
4
<Location /server-status>
	SetHandler server-status
	Require host <OpenTelemetry Collector host>
</Location>

For more details regarding configuring the Apache remote connection, see the official Apache documentation.

Configure the Collector receiver

In the Collector configuration file, add Apache as a receiver and set the endpoint to address of the Apache server.

1
2
3
receivers:
  apache:
      endpoint: "http://<address of server>:<port>/server-status?auto"

The OpenTelemetry repo’s readme provides additional details about Apache configuration.

Enable the Collector receiver

Once the Apache receiver is configured, enable it by adding it to one or more pipelines as described in the Collector configuration documentation.

Validate metrics are reporting to Cloud Observability

You can validate that metrics are reporting to Cloud Observability on the Metrics details page in Settings.

  1. In Cloud Observability, click Settings > Metric details.

  2. Search for Apache metric names. Arrow points to the metrics search box.

    See the receiver’s metadata file for a complete list of emitted metrics.

  3. If needed, click on the metric to edit the description and how the units are displayed in Cloud Observability.

Create a dashboard for the metrics

Use the Cloud Observability Terraform Provider to create a dashboard for the metrics.

Additional resources

For a more complete example that’s ready to run, see the Apache integration in Cloud Observability OpenTelemetry Examples.

See also

Create and manage dashboards

Create alerts

Updated Dec 1, 2022