Question

Difficulty: MediumMonitoring and Logging

An infrastructure team needs to collect OS-level memory metrics and system logs from a fleet of Compute Engine virtual machines running Linux. The solution must align with Google-recommended security and observability best practices. Which TWO actions should you perform?

  1. Install and configure the Google Cloud Ops Agent on each Compute Engine instance.Answer
  2. Assign the Monitoring Metric Writer and Logs Writer roles to the service account attached to the Compute Engine instances.Answer
  3. C
    Install the legacy Stackdriver Monitoring agent and Stackdriver Logging agent separately on each virtual machine instance.
  4. D
    Grant the primitive Editor role to the Compute Engine default service account to authorize metric and log submission.

Answer

To collect system memory metrics and logs securely according to Google Cloud best practices, you should install the unified Google Cloud Ops Agent on each VM instance and ensure the VM's service account has the specific predefined roles: Monitoring Metric Writer and Logs Writer.
The unified Google Cloud Ops Agent is Google's recommended agent for collecting telemetry (metrics and logs) from Compute Engine instances. To write this telemetry data to Google Cloud Observability tools safely, the VM's associated service account only requires the specific predefined roles Monitoring Metric Writer and Logs Writer.

Step-by-Step Solution

1
Identify the primary telemetry agent for GCP Compute Engine VMs
Determine that the Google Cloud Ops Agent combines logging and metric collection into a single supported package.
The legacy agents are deprecated, and the Ops Agent provides unified support for system metrics like memory and swap space.
2
Identify the required IAM permissions following least privilege principles
Determine that Monitoring Metric Writer (roles/monitoring.metricWriter) and Logs Writer (roles/logging.logWriter) are required.
Avoid using broad primitive roles (such as Editor or Owner) to maintain a secure IAM baseline.

Key Concept

Compute Engine telemetry collection requires installing the Google Cloud Ops Agent and assigning minimal predefined IAM roles to the instance service account.
Rate this question