Skip to content

Latest commit

 

History

History

apache

Agent Check: Apache Web Server

Apache Dashboard

Overview

The Apache check tracks requests per second, bytes served, number of worker threads, service uptime, and more.

Setup

Installation

The Apache check is packaged with the Agent. To start gathering your Apache metrics and logs, you need to:

  1. Install the Agent on your Apache servers.

  2. Install mod_status on your Apache servers and enable ExtendedStatus.

Configuration

Host

Follow the instructions below to configure this check for an Agent running on a host. For containerized environments, see the Containerized section.

Metric collection
  1. Edit the apache.d/conf.yaml file in the conf.d/ folder at the root of your Agent's configuration directory to start collecting your Apache metrics. See the sample apache.d/conf.yaml for all available configuration options.

    init_config:
    
    instances:
      ## @param apache_status_url - string - required
      ## Status url of your Apache server.
      #
      - apache_status_url: http://localhost/server-status?auto
  2. Restart the Agent.

Log collection

Available for Agent versions >6.0

  1. Collecting logs is disabled by default in the Datadog Agent, you need to enable it in datadog.yaml:

    logs_enabled: true
  2. Add this configuration block to your apache.d/conf.yaml file to start collecting your Apache Logs:

    logs:
      - type: file
        path: /var/log/apache2/access.log
        source: apache
        service: apache
    
      - type: file
        path: /var/log/apache2/error.log
        source: apache
        service: apache

    Change the path and service parameter values and configure them for your environment. See the sample apache.d/conf.yaml for all available configuration options.

  3. Restart the Agent.

Containerized

For containerized environments, see the Autodiscovery Integration Templates for guidance on applying the parameters below.

Metric collection
Parameter Value
<INTEGRATION_NAME> apache
<INIT_CONFIG> blank or {}
<INSTANCE_CONFIG> {"apache_status_url": "http://%%host%%/server-status?auto"}
Log collection

Available for Agent versions >6.0

Collecting logs is disabled by default in the Datadog Agent. To enable it, see Docker log collection.

Parameter Value
<LOG_CONFIG> {"source": "apache", "service": "<SERVICE_NAME>"}

Validation

Run the Agent's status subcommand and look for apache under the Checks section.

Data Collected

Metrics

See metadata.csv for a list of metrics provided by this check.

Events

The Apache check does not include any events.

Service Checks

apache.can_connect:
Returns CRITICAL if the Agent cannot connect to the configured apache_status_url, otherwise returns OK.

Troubleshooting

Apache status URL

If you are having issues with your Apache integration, it is mostly like due to the Agent not being able to access your Apache status URL. Try running curl for the apache_status_url listed in your apache.d/conf.yaml file (include your login credentials if applicable).

Further Reading

Additional helpful documentation, links, and articles: