- 重要な情報
- はじめに
- 用語集
- ガイド
- エージェント
- インテグレーション
- OpenTelemetry
- 開発者
- API
- CoScreen
- アプリ内
- Service Management
- インフラストラクチャー
- アプリケーションパフォーマンス
- 継続的インテグレーション
- ログ管理
- セキュリティ
- UX モニタリング
- 管理
Supported OS
Apache チェックは、毎秒のリクエスト数、処理されたバイト数、ワーカースレッド数、サービスアップタイムなどを追跡します。
Apache チェックは Datadog Agent にパッケージ化されています。Apache のメトリクスとログの収集を開始するには、以下を行います。
Apache サーバーに Agent をインストールします。
Apache サーバーに mod_status
をインストールし、ExtendedStatus
を有効にします。
ホストで実行中の Agent に対してこのチェックを構成するには:
Apache メトリクスの収集を開始するには、Agent のコンフィギュレーションディレクトリのルートにある conf.d/
フォルダーの apache.d/conf.yaml
ファイルを編集します。使用可能なすべてのコンフィギュレーションオプションの詳細については、サンプル 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
Agent バージョン 6.0 以降で利用可能
Datadog Agent で、ログの収集はデフォルトで無効になっています。datadog.yaml
で有効にします。
logs_enabled: true
このコンフィギュレーションブロックを apache.d/conf.yaml
ファイルに追加して、Apache ログの収集を開始します。このとき、お使いの環境に応じて構成するために path
と service
の値が調整されます。
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 を参照してください。
コンテナで実行中の 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 Agent で、ログの収集はデフォルトで無効になっています。有効にする方法については、Docker ログ収集を参照してください。
次に、ログインテグレーションを Docker ラベルとして設定します。
LABEL "com.datadoghq.ad.logs"='[{"source": "apache", "service": "<SERVICE_NAME>"}]'
このチェックを、Kubernetes で実行している Agent に構成します。
アプリケーションのコンテナで、オートディスカバリーのインテグレーションテンプレートをポッドアノテーションとして設定します。他にも、ファイル、ConfigMap、または key-value ストアを使用してテンプレートを構成できます。
Annotations v1 (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 (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
Datadog Agent で、ログの収集はデフォルトで無効になっています。有効にする方法については、Kubernetes ログ収集を参照してください。
次に、ログのインテグレーションをポッドアノテーションとして設定します。これは、ファイル、ConfigMap、または key-value ストアを使用して構成することも可能です。
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
このチェックを、ECS で実行している Agent に構成するには:
アプリケーションのコンテナで、オートディスカバリーのインテグレーションテンプレートを Docker ラベルとして設定します。
{
"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 Agent で、ログの収集はデフォルトで無効になっています。有効にする方法については、ECS ログ収集を参照してください。
次に、ログインテグレーションを Docker ラベルとして設定します。
{
"containerDefinitions": [{
"name": "apache",
"image": "apache:latest",
"dockerLabels": {
"com.datadoghq.ad.logs": "[{\"source\":\"apache\",\"service\":\"<YOUR_APP_NAME>\"}]"
}
}]
}
Agent の status サブコマンドを実行し、Checks セクションの apache
を探します。
apache.conns_total (gauge) | The total number of connections performed. Shown as connection |
apache.conns_async_writing (gauge) | The number of asynchronous writes connections. Shown as connection |
apache.conns_async_keep_alive (gauge) | The number of asynchronous keep alive connections. Shown as connection |
apache.conns_async_closing (gauge) | The number of asynchronous closing connections. 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.cpu_load (gauge) | The percent of CPU used. Shown as percent |
apache.performance.busy_workers (gauge) | The number of workers serving requests. Shown as thread |
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.waiting_for_connection (gauge) | The number of workers that can immediately process an incoming request. 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.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.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.dns_lookup (gauge) | The workers waiting on a DNS lookup. Shown as thread |
apache.scoreboard.closing_connection (gauge) | The amount of workers that are currently closing a connection. Shown as thread |
apache.scoreboard.logging (gauge) | The workers writing something to the Apache logs. 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.open_slot (gauge) | The amount of workers that Apache can still start before hitting the maximum number of workers. Shown as thread |
apache.scoreboard.disabled (gauge) | These slots will never be able to handle any requests, indicates a misconfiguration. Shown as thread |
Apache チェックにはイベントは含まれません。
apache.can_connect
Agent が監視対象の Apache インスタンスに接続できない場合は、CRITICAL
を返します。それ以外の場合は、OK
を返します。
Statuses: ok, クリティカル
Apache インテグレーションで問題が発生する場合の多くは、Agent が Apache のステータス URL にアクセスできないことが原因です。apache.d/conf.yaml
ファイルに一覧表示されている apache_status_url
に対して curl を実行してみてください (必要に応じてログイン資格情報を指定)。
お役に立つドキュメント、リンクや記事: