Apache

Supported OS Linux Windows Mac OS

Integration version4.5.0

Apache 대시보드

개요

Apache 점검은 초당 요청, 제공된 바이트, 작업자 스레드 수, 서비스 업타임 등을 추적합니다.

설정

설치

Apache 점검은 Datadog 에이전트를 사용해 패키징됩니다. Apache 메트릭과 로그를 수집하려면 다음을 해야 합니다.

  1. Apache 서버에 에이전트를 설치합니다.

  2. Apache 서버에 mod_status를 설치한 다음 ExtendedStatus를 활성화합니다.

설정

호스트

호스트에서 실행 중인 에이전트에 대해 이 점검을 구성하려면:

메트릭 수집
  1. 에이전트 설정 디렉터리의 루트에 있는 conf.d/ 폴더에서 apache.d/conf.yaml 파일을 편집하여 Apache 메트릭 수집을 시작합니다. 사용 가능한 모든 설정 옵션은 샘플 apache.d/conf.yaml를 참조하세요.

    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.

로그 수집

에이전트 버전 > 6.0 이상 사용 가능

  1. 로그 수집은 기본적으로 Datadog 에이전트에서 비활성화되어 있습니다. datadog.yaml에서 활성화하세요.

    logs_enabled: true
    
  2. apache.d/conf.yaml 파일에 이 설정 블록을 추가해 Apache 로그 수집을 시작하세요. pathservice 값을 조정해 환경에 맞게 설정하세요.

    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
    

    사용 가능한 모든 설정 옵션에 대해 샘플 apache.d/conf.yaml를 참조하세요.

  3. Restart the Agent.

Docker

컨테이너에서 실행되는 에이전트에 대해 이 점검을 구성하려면,

메트릭 수집

도커가 애플리케이션 컨테이너를 레이블링하면 자동탐지 통합 템플릿을 설정하세요.

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"}]'
로그 수집

기본적으로 로그 수집은 Datadog 에이전트에서 비활성화되어 있습니다. 활성화하려면 도커(Docker) 로그 수집을 참조하세요.

그런 다음 도커(Docker) 레이블로 로그 통합을 설정하세요.

LABEL "com.datadoghq.ad.logs"='[{"source": "apache", "service": "<SERVICE_NAME>"}]'

Kubernetes

쿠버네티스(Kubernetes)에서 실행되는 에이전트에 대해 이 점검을 구성하는 방법:

메트릭 수집

자동탐지 통합 템플릿을 애플리케이션 컨테이너의 포드 주석으로 설정합니다. 이외 템플릿은 또한 파일, configmap, key-value store로 설정할 수 있습니다.

주석 v1 (Datadog 에이전트 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

주석 v2(Datadog 에이전트 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
로그 수집

Datadog 에이전트에서 기본적으로 로그 수집이 비활성화되어 있습니다. 활성화하려면 [쿠버네티스(Kubernetes) 로그 수집]을 확인하세요.

그런 다음 로그 통합을 포드 주석으로 설정합니다. 또한 파일, configmap, 또는 key-value store로 설정할 수 있습니다.

주석 v1/v2

apiVersion: v1
kind: Pod
metadata:
  name: apache
  annotations:
    ad.datadoghq.com/apache.logs: '[{"source":"apache","service":"<SERVICE_NAME>"}]'
spec:
  containers:
    - name: apache

ECS

ECS에서 실행되는 에이전트에 대해 이 점검을 설정하는 방법:

메트릭 수집

도커가 애플리케이션 컨테이너를 레이블링하면 자동탐지 통합 템플릿을 설정하세요.

{
  "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\"}]"
    }
  }]
}
로그 수집

기본적으로 로그 수집은 Datadog 에이전트에서 비활성화되어 있습니다. 활성화하려면 ECS 로그 수집을 참조하세요.

그런 다음 도커(Docker) 레이블로 로그 통합을 설정하세요.

{
  "containerDefinitions": [{
    "name": "apache",
    "image": "apache:latest",
    "dockerLabels": {
      "com.datadoghq.ad.logs": "[{\"source\":\"apache\",\"service\":\"<YOUR_APP_NAME>\"}]"
    }
  }]
}

검증

에이전트 상태 하위 명령을 실행하고 점검 섹션에서 apache를 찾습니다.

수집한 데이터

메트릭

apache.conns_async_closing
(gauge)
The number of asynchronous closing connections.
Shown as connection
apache.conns_async_keep_alive
(gauge)
The number of asynchronous keep alive connections.
Shown as connection
apache.conns_async_writing
(gauge)
The number of asynchronous writes connections.
Shown as connection
apache.conns_total
(gauge)
The total number of connections performed.
Shown as connection
apache.net.bytes
(gauge)
The total number of bytes served.
Shown as byte
apache.net.bytes_per_s
(gauge)
The number of bytes served per second.
Shown as byte
apache.net.hits
(gauge)
The total number of requests performed.
Shown as request
apache.net.request_per_s
(gauge)
The number of requests performed per second.
Shown as request
apache.performance.busy_workers
(gauge)
The number of workers serving requests.
Shown as thread
apache.performance.cpu_load
(gauge)
The percent of CPU used.
Shown as percent
apache.performance.idle_workers
(gauge)
The number of idle workers.
Shown as thread
apache.performance.max_workers
(gauge)
The maximum number of workers apache can start.
Shown as thread
apache.performance.uptime
(gauge)
The amount of time the server has been running.
Shown as second
apache.scoreboard.closing_connection
(gauge)
The amount of workers that are currently closing a connection.
Shown as thread
apache.scoreboard.disabled
(gauge)
These slots will never be able to handle any requests, indicates a misconfiguration.
Shown as thread
apache.scoreboard.dns_lookup
(gauge)
The workers waiting on a DNS lookup.
Shown as thread
apache.scoreboard.gracefully_finishing
(gauge)
The number of workers finishing their request.
Shown as thread
apache.scoreboard.idle_cleanup
(gauge)
These workers were idle and their process is being stopped.
Shown as thread
apache.scoreboard.keepalive
(gauge)
The workers intended for a new request from the same client, because it asked to keep the connection alive.
Shown as thread
apache.scoreboard.logging
(gauge)
The workers writing something to the Apache logs.
Shown as thread
apache.scoreboard.open_slot
(gauge)
The amount of workers that Apache can still start before hitting the maximum number of workers.
Shown as thread
apache.scoreboard.reading_request
(gauge)
The workers reading the incoming request.
Shown as thread
apache.scoreboard.sending_reply
(gauge)
The number of workers sending a reply/response or waiting on a script (like PHP) to finish so they can send a reply.
Shown as thread
apache.scoreboard.starting_up
(gauge)
The workers that are still starting up and not yet able to handle a request.
Shown as thread
apache.scoreboard.waiting_for_connection
(gauge)
The number of workers that can immediately process an incoming request.
Shown as thread

이벤트

Apache 점검은 이벤트를 포함하지 않습니다.

서비스 검사

apache.can_connect
Returns CRITICAL if the Agent is unable to connect to the monitored Apache instance. Returns OK otherwise.
Statuses: ok, critical

트러블슈팅

Apache 상태 URL

Apache 통합 에 문제가 있는 경우 대부분 에이전트가 Apache 상태에 액세스할 수 없기 때문인 경우가 많습니다. apache.d/conf.yaml 파일에 나열된 apache_status_url(해당되는 경우 로그인 자격 증명 포함)에 대해 curl을 실행해 보세요.

참고 자료

기타 유용한 문서, 링크 및 기사: