The Apache check tracks requests per second, bytes served, number of worker threads, service uptime, and more.
The Apache check is packaged with the Datadog Agent. To start gathering your Apache metrics and logs, you need to:
-
Install the Agent on your Apache servers.
-
Install
mod_status
on your Apache servers and enableExtendedStatus
.
To configure this check for an Agent running on a host:
-
Edit the
apache.d/conf.yaml
file in theconf.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
Available for Agent versions >6.0
-
Collecting logs is disabled by default in the Datadog Agent. Enable it in
datadog.yaml
:logs_enabled: true
-
Add this configuration block to your
apache.d/conf.yaml
file to start collecting your Apache logs, adjusting thepath
andservice
values to configure them for your environment:logs: - type: file path: /path/to/your/apache/access.log source: apache service: apache sourcecategory: http_web_access - type: file path: /path/to/your/apache/error.log source: apache service: apache sourcecategory: http_web_error
See the sample apache.d/conf.yaml for all available configuration options.
To configure this check for an Agent running on a container:
Set Autodiscovery Integrations Templates as Docker labels on your application container:
LABEL "com.datadoghq.ad.check_names"='["apache"]'
LABEL "com.datadoghq.ad.init_configs"='[{}]'
LABEL "com.datadoghq.ad.instances"='[{"apache_status_url": "http://%%host%%/server-status?auto"}]'
Collecting logs is disabled by default in the Datadog Agent. To enable it, see Docker Log Collection.
Then, set Log Integrations as Docker labels:
LABEL "com.datadoghq.ad.logs"='[{"source": "apache", "service": "<SERVICE_NAME>"}]'
To configure this check for an Agent running on Kubernetes:
Set Autodiscovery Integrations Templates as pod annotations on your application container. Aside from this, templates can also be configured with a file, a configmap, or a key-value store.
Annotations v1 (for Datadog Agent < v7.36)
apiVersion: v1
kind: Pod
metadata:
name: apache
annotations:
ad.datadoghq.com/apache.check_names: '["apache"]'
ad.datadoghq.com/apache.init_configs: '[{}]'
ad.datadoghq.com/apache.instances: |
[
{
"apache_status_url": "http://%%host%%/server-status?auto"
}
]
spec:
containers:
- name: apache
Annotations v2 (for Datadog Agent v7.36+)
apiVersion: v1
kind: Pod
metadata:
name: apache
annotations:
ad.datadoghq.com/apache.checks: |
{
"apache": {
"init_config": {},
"instances": [
{
"apache_status_url": "http://%%host%%/server-status?auto"
}
]
}
}
spec:
containers:
- name: apache
Collecting logs is disabled by default in the Datadog Agent. To enable it, see Kubernetes Log Collection.
Then, set Log Integrations as pod annotations. This can also be configured with a file, a configmap, or a key-value store.
Annotations v1/v2
apiVersion: v1
kind: Pod
metadata:
name: apache
annotations:
ad.datadoghq.com/apache.logs: '[{"source":"apache","service":"<SERVICE_NAME>"}]'
spec:
containers:
- name: apache
To configure this check for an Agent running on ECS:
Set Autodiscovery Integrations Templates as Docker labels on your application container:
{
"containerDefinitions": [{
"name": "apache",
"image": "apache:latest",
"dockerLabels": {
"com.datadoghq.ad.check_names": "[\"apache\"]",
"com.datadoghq.ad.init_configs": "[{}]",
"com.datadoghq.ad.instances": "[{\"apache_status_url\": \"http://%%host%%/server-status?auto\"}]"
}
}]
}
Collecting logs is disabled by default in the Datadog Agent. To enable it, see ECS Log Collection.
Then, set Log Integrations as Docker labels:
{
"containerDefinitions": [{
"name": "apache",
"image": "apache:latest",
"dockerLabels": {
"com.datadoghq.ad.logs": "[{\"source\":\"apache\",\"service\":\"<YOUR_APP_NAME>\"}]"
}
}]
}
Run the Agent's status subcommand and look for apache
under the Checks section.
See metadata.csv for a list of metrics provided by this check.
The Apache check does not include any events.
See service_checks.json for a list of service checks provided by this integration.
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).
Additional helpful documentation, links, and articles: