9.2. 모니터링 및 로깅 사용자 정의
지표는 Ansible,Podman 및 Google Ops Agent 에서 제공합니다. Google Ops Agent 및 Podman은 자동화 컨트롤러 및 자동화 허브 VM 인스턴스에 설치되지만 Ansible 메트릭은 자동화 허브 인스턴스에만 설치됩니다.
구성 가능한 프로세스(collector)는 각 자동화 컨트롤러 VM 인스턴스 및 자동화 허브 VM 인스턴스에서 실행되어 수집된 Ansible 및 Podman 지표를 Google Cloud Platform 모니터링으로 내보냅니다. Google Ops 에이전트가 Google Cloud 솔루션의 일부이므로 자체 구성 파일이 있습니다.
Google Ops 에이전트도 로깅 구성을 담당합니다.
모니터링 및 로깅 기능에 대해 monitoring.googleapis.com 및 logging.googleapis.com 을 각각 활성화해야 합니다.
설정
구성 파일은 각 자동화 컨트롤러 및 자동화 허브에서 공유하는 디스크에 있습니다. /aap/bootstrap/config_file_templates/<controller|hub>/monitoring.yml 파일을 수정하여 모든 내보내기 및 에이전트를 구성합니다.
9.2.1. Ansible 및 podman 구성
자동화 컨트롤러 또는 자동화 허브의 /aap/bootstrap/config_file_templates/<controller|hub>/monitoring.yaml 파일에는 Ansible 및 podman 메트릭을 GCP로 수집하고 보내는 구성이 포함되어 있습니다.
자동화 컨트롤러의 기본 구성은 다음과 같습니다.
# 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
자동화 허브의 기본 구성은 다음과 같습니다.
# 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
여기서 수집기 는 수집기당 하나의 항목이 있는 구성 배열, 즉 awx 및 podman입니다.
awx 수집기에는 인증이 필요하므로 userName 을 admin 으로 설정해야 합니다. 암호는 secret-manager에서 검색됩니다.
엔드포인트는 변경하지 않아야 합니다.
defaultCollectorInterval 은 내보내기가 메트릭 끝점에서 정보를 수집하여 Google Cloud Platform Monitoring으로 전송하는 기본 간격을 지정합니다.
이 값을 0 으로 설정하거나 이 속성을 생략하면 모든 수집기가 비활성화됩니다.
각 수집기는 enabled를 true 또는 false 로 설정하여 별도로 활성화 하거나 비활성화할 수 있습니다.
수집기는 제품군별로 그룹화된 모든 메트릭을 반환하지만, 배열 제외 메트릭에 해당 이름을 추가하여 Google Cloud Platform Monitoring으로 전송해서는 안 되는 제품군을 제외할 수 있습니다.
다른 모든 제품군 지표의 경우 수집할 간격을 지정하여 Google Cloud Platform Monitoring으로 보낼 수 있습니다. 수집기 간격은 모든 제품군 지표 간격과 defaultCollectorInterval 사이의 최소값입니다. 이를 통해 Google Cloud Platform Monitoring으로 전송되는 각 메트릭 세트에 대한 컬렉션이 수행됩니다.
9.2.2. Google Cloud ops 에이전트 구성
설정 파일 세부 정보는 여기에서 확인할 수 있습니다.
구성 파일은 /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 에이전트에서 수집해야 하는 항목을 지정하는 여러 수신자가 포함되어 있습니다.
배포 중에 연결 로깅 및 연결 메트릭 을 선택하면 파일에 포함된 파이프라인과 로그 및 메트릭이 GCP로 수집되어 전송됩니다.
배포 후 파이프라인을 추가해야 하는 경우 /aap/bootstrap/config_file_templates/hub|controller/gcp-ops-agent-config.yml 에 삽입할 수 있습니다.
gcp-ops-agent-config.yml 이 지난 10분 내에 변경된 경우 crontab 작업은 에이전트를 다시 시작합니다. 에이전트는 다시 시작한 후 구성을 다시 읽습니다.