9.2. モニタリングとロギングのカスタマイズ

メトリクスは、AnsiblePodman、および Google Ops Agent によって提供されます。Google Ops Agent と Podman は Automation Controller と Automation Hub 仮想マシンインスタンスにインストールされますが、Ansible メトリックは Automation Hub インスタンスにのみインストールされます。

設定可能なプロセス (コレクター) が各 Automation Controller 仮想マシンインスタンスと Automation Hub 仮想マシンインスタンスで実行し、収集された Ansible メトリックと Podman メトリックを Google Cloud Platform Monitoring にエクスポートします。Google Ops Agent は Google Cloud ソリューションの一部であるため、独自の設定ファイルがあります。

Google Ops エージェントは、ロギングの設定も担当します。

サービス API の monitoring.googleapis.comlogging.googleapis.com は、モニタリング機能とロギング機能に対してそれぞれ有効にする必要があります。

設定

設定ファイルは、各 Automation Controller および Automation Hub が共有するディスク上にあります。ファイル /aap/bootstrap/config_file_templates/<controller|hub>/monitoring.yml を変更して、すべてのエクスポーターとエージェントを設定します。

9.2.1. Ansible と podman の設定

Automation Controller または Automation Hub のファイル /aap/bootstrap/config_file_templates/<controller|hub>/monitoring.yaml には、Ansible および Podman メトリックを収集して、GCP に送信するための設定が含まれています。

Automation Controller のデフォルト設定は次のようになります。

# This value will be set at deployment time.
# Set to zero if monitoringEnabled is false otherwise 59s
# The collection interval for each collector will be the minimum
# between the defaultCollectorInterval and all send Interval
# of a given collector
# NB: The awx exported should not run on controllers as
# it duplicates the number of records sent to GCP Monitoring

defaultCollectorInterval: $DEFAULT_COLLECTOR_INTERVAL
collectors:
- name: podman
 endpoint: http://localhost:9882/podman/metrics
 enabled: true

# list of metrics to exclude
# excludedMetrics:
# - podman_container_created_seconds

 metrics:
 - name: podman_container_exit_code
   # interval on which the metric must be pushed to gcp
   sendInterval: 59s

Automation Hub のデフォルト設定は次のようになります。

# This value will be set at deployment time.
# Set to zero if monitoringEnabled is false otherwise 59s
# The collection interval for each collector will be the minimum
# between the defaultCollectorInterval and all sendInterval
# of a given collector
# NB: The awx exporter should not run on controllers as
# it duplicates the number of records sent to GCP Monitoring

defaultCollectorInterval: 59s
collectors:
- name: awx
 userName: admin
 endpoint: http://<Controller_LB_IP>/api/v2/metrics/
 enabled: true
 metrics:
 - name: awx_inventories_total
   # interval on which the metric must be pushed to gcp
   sendInterval: 59s
- name: podman
 endpoint: http://localhost:9882/podman/metrics
 enabled: true

# list of metrics to exclude
#  excludedMetrics:
#  - podman_container_created_seconds

 metrics:
 - name: podman_container_exit_code
   # interval on which the metric must be pushed to gcp
   sendInterval: 59s

ここで、collectors は、コレクターごとに項目 (awx と podman) が 1 つ含まれる設定配列です。

awx コレクターには認証が必要なため、userNameadmin に設定する必要があります。パスワードは secret-manager から取得されます。

エンドポイントは変更しないでください。

defaultCollectorInterval は、エクスポーターがメトリクスエンドポイントから情報を収集して Google Cloud Platform Monitoring に送信するデフォルトの間隔を指定します。

この値を 0 に設定するか、この属性を省略すると、すべてのコレクターが無効になります。

各コレクターは、enabledtrue または false に設定することで個別に有効または無効にできます。

コレクターは、ファミリー別にグループ化された使用可能なすべての指標を返しますが、配列 excludeMetrics に名前を追加することで、Google Cloud Platform Monitoring に送信してはならないファミリーを excludedMetrics できます。

他のすべてのファミリーメトリクスについては、収集して Google Cloud Platform Monitoring に送信する間隔を指定できます。コレクター間隔は、すべてのファミリーメトリック間隔と defaultCollectorInterval の間の最小値です。これにより、Google Cloud Platform Monitoring に送信される指標のセットごとにコレクションが作成されます。

9.2.2. Google クラウドオペレーションエージェントの設定

設定ファイルの詳細は、こちら を参照してください。

設定ファイルは /etc/google-cloud-ops-agent/config.yml にあります。

これは、コンポーネントタイプに応じて、共有ディスク /aap/bootstrap/config_file_templates/controller/gcp-ops-agent-config.yml または /aap/bootstrap/config_file_templates/hub/gcp-ops-agent-config.yml へのシンボリックリンクです。

設定ファイルには、ops エージェントが収集する必要のある情報を指定するレシーバーが複数含まれています。

デプロイ時の Connect LoggingConnect Metrics の選択によって、ファイルに含まれるパイプラインが決まり、どのログと指標が収集されて GCP に送信されるかが決まります。

デプロイ後にさらにパイプラインを追加する必要がある場合は、それらを /aap/bootstrap/config_file_templates/hub|controller/gcp-ops-agent-config.yml に挿入できます。

過去 10 分間に gcp-ops-agent-config.yml が変更された場合、crontab ジョブはエージェントを再起動します。エージェントは再起動後に設定を再読み込みします。