This content originally appeared on DEV Community and was authored by Latchu@DevOps
The Ops Agent is Google Cloud’s recommended agent for monitoring and logging on Compute Engine VMs.
It replaces the legacy Monitoring and Logging agents with a single, unified agent that provides:
- âś… Better performance
- âś… Easy installation and management
- âś… Support for both Linux and Windows
- âś… Built-in support for logs, metrics, and third-party applications
In this tutorial, we’ll go step by step to:
- Install Ops Agent
- Verify monitoring and logging integration
- Explore the metrics and logs in Cloud Monitoring and Logging
Step 01: Introduction
We’ll try two installation methods:
- Method 1: Install Ops Agent during VM creation (Console)
- Method 2: Install Ops Agent manually on an existing VM (CLI + SSH)
Step 02: Install Ops Agent
🔹 Step 02-01: Install Ops Agent using Google Cloud Console
- Go to Compute Engine → VM Instances → CREATE INSTANCE
- Name: demo1-opsagent
- Under Observability → Ops Agent → Check ✅ Install Ops Agent for Monitoring and Logging
- Click CREATE
That’s it! The Ops Agent is automatically installed on the VM.
VM > Observability
🔹 Step 02-02: Install Ops Agent Manually
Create a VM instance from CLI:
# Create VM Instance
gcloud compute instances create demo2-opsagent \
--zone=us-central1-a \
--machine-type=e2-micro \
--network-interface=subnet=default \
--tags=http-server \
--metadata-from-file=startup-script=webserver-install.sh
🔍 Verify VM Metrics:
- Go to Compute Engine → VM Instances → demo2-opsagent → OBSERVABILITY Tab
- Click on CPU, PROCESS, MEMORY
- You’ll see a message "Requires Ops Agent" if the agent is not yet installed.
SSH into VM and install Ops Agent:
# Connect to VM
gcloud compute ssh --zone "us-central1-a" "demo2-opsagent" --project "gcpdemos"
# Download Ops Agent
curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh
# Install Ops Agent
sudo bash add-google-cloud-ops-agent-repo.sh --also-install
# Verify Installation
sudo apt list --installed | grep google-cloud-ops-agent
# Check Status
sudo systemctl status google-cloud-ops-agent"*"
# Restart Agent (Optional)
sudo service google-cloud-ops-agent restart
Step 03: Review VM Monitoring Metrics
- Go to Compute Engine → VM Instances → demo2-opsagent
- Click on the Observability tab
- Check metrics like:
- CPU
- Processes
- Memory
- Disk capacity
Step 05: Verify Cloud Monitoring Tool
- Go to Monitoring → Overview
- Click VIEW GCE DASHBOARD → VMs Dashboard
- Verify Agent Status → Ops Agent
Step 06: Review Metrics & Logs Tabs
- Go to Monitoring → Overview → GCE Dashboard → VMs Dashboard
- Explore:
- Metrics Tab → CPU, Memory, Disk, Processes
- Logs Tab → System logs collected via Ops Agent
Step 07: Verify Logs in Logs Explorer
- Go to Logging → Logs Explorer
- Select Resource Name: demo2-opsagent
- Verify the system and application logs
Step 08: Cleanup
Delete the VMs created for this demo:
gcloud compute instances delete demo1-opsagent demo2-opsagent --zone=us-central1-a
✅ That’s it! You’ve successfully installed, verified, and explored the Google Cloud Ops Agent for Compute Engine VMs.
This content originally appeared on DEV Community and was authored by Latchu@DevOps

Latchu@DevOps | Sciencx (2025-08-22T11:56:42+00:00) Part-20: 🚀 Google Cloud Compute Engine – Install & Verify Ops Agent for Logging and Monitoring in Google Cloud Platform (GCP). Retrieved from https://www.scien.cx/2025/08/22/part-20-%f0%9f%9a%80-google-cloud-compute-engine-install-verify-ops-agent-for-logging-and-monitoring-in-google-cloud-platform-gcp/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.