Question

Difficulty: MediumMonitoring and Logging

Your organization is deploying a fleet of Compute Engine virtual machines hosting a critical enterprise web application. To ensure effective operational monitoring, you need to collect guest OS-level metrics, such as memory utilization, as well as application log files from the file system into Cloud Observability. Which TWO configuration steps should you perform to enable this telemetry collection using Google recommended practices?

  1. Install and configure the unified Google Cloud Ops Agent on each Compute Engine instance.Answer
  2. Attach a service account to the VM instances with the Monitoring Metric Writer (roles/monitoring.metricWriter) and Logs Writer (roles/logging.logWriter) predefined IAM roles.Answer
  3. C
    Install the standalone legacy Stackdriver Monitoring Agent and Stackdriver Logging Agent packages on each VM instance.
  4. D
    Grant the primitive Editor (roles/editor) role to the attached VM service account at the GCP project level.

Answer

Installing the unified Google Cloud Ops Agent on the VM instances and assigning the Monitoring Metric Writer and Logs Writer predefined roles to the VM service account.
To capture guest OS-level metrics like RAM usage alongside custom log files, Google Cloud requires installing the unified Ops Agent on Compute Engine instances. Furthermore, the attached service account must possess specific predefined roles (`roles/monitoring.metricWriter` and `roles/logging.logWriter`) to transmit telemetry data securely following least-privilege security practices.

Step-by-Step Solution

1
Identify agent requirements for OS memory metrics and log collection
Recognize that default Compute Engine telemetry does not capture guest OS memory or disk metrics without an agent, and the unified Ops Agent is the current standard.
The Ops Agent combines logging and metrics capabilities into a single binary for Compute Engine.
2
Determine least-privilege IAM configuration for telemetry ingestion
Select predefined roles: `roles/monitoring.metricWriter` and `roles/logging.logWriter` for the instance service account.
The Ops Agent runs under the identity of the VM's service account and requires explicit permissions to write metrics and logs to Google Cloud Observability.

Key Concept

Compute Engine Telemetry Collection with Google Cloud Ops Agent
Rate this question