Part-20: ๐Ÿš€ Google Cloud Compute Engine โ€“ Install & Verify Ops Agent for Logging and Monitoring in Google Cloud Platform (GCP)

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 manageme…


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:

  1. Install Ops Agent
  2. Verify monitoring and logging integration
  3. 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

  1. Go to Compute Engine โ†’ VM Instances โ†’ CREATE INSTANCE
  2. Name: demo1-opsagent
  3. Under Observability โ†’ Ops Agent โ†’ Check โœ… Install Ops Agent for Monitoring and Logging
  4. Click CREATE

Thatโ€™s it! The Ops Agent is automatically installed on the VM.

ops-1

VM > Observability

ops-2

๐Ÿ”น 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 

ops-3

๐Ÿ” Verify VM Metrics:

  1. Go to Compute Engine โ†’ VM Instances โ†’ demo2-opsagent โ†’ OBSERVABILITY Tab
  2. Click on CPU, PROCESS, MEMORY
  3. Youโ€™ll see a message "Requires Ops Agent" if the agent is not yet installed.

ops-4

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

  1. Go to Compute Engine โ†’ VM Instances โ†’ demo2-opsagent
  2. Click on the Observability tab
  3. Check metrics like:
  • CPU
  • Processes
  • Memory
  • Disk capacity

ops-5n

Step 05: Verify Cloud Monitoring Tool

  1. Go to Monitoring โ†’ Overview
  2. Click VIEW GCE DASHBOARD โ†’ VMs Dashboard
  3. Verify Agent Status โ†’ Ops Agent

Step 06: Review Metrics & Logs Tabs

  1. Go to Monitoring โ†’ Overview โ†’ GCE Dashboard โ†’ VMs Dashboard
  2. Explore:
  • Metrics Tab โ†’ CPU, Memory, Disk, Processes
  • Logs Tab โ†’ System logs collected via Ops Agent

ops-6

Step 07: Verify Logs in Logs Explorer

  1. Go to Logging โ†’ Logs Explorer
  2. Select Resource Name: demo2-opsagent
  3. Verify the system and application logs

ops-7

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


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » Part-20: ๐Ÿš€ Google Cloud Compute Engine โ€“ Install & Verify Ops Agent for Logging and Monitoring in Google Cloud Platform (GCP)." Latchu@DevOps | Sciencx - Friday August 22, 2025, 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/
HARVARD
Latchu@DevOps | Sciencx Friday August 22, 2025 » Part-20: ๐Ÿš€ Google Cloud Compute Engine โ€“ Install & Verify Ops Agent for Logging and Monitoring in Google Cloud Platform (GCP)., viewed ,<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/>
VANCOUVER
Latchu@DevOps | Sciencx - » Part-20: ๐Ÿš€ Google Cloud Compute Engine โ€“ Install & Verify Ops Agent for Logging and Monitoring in Google Cloud Platform (GCP). [Internet]. [Accessed ]. Available 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/
CHICAGO
" » Part-20: ๐Ÿš€ Google Cloud Compute Engine โ€“ Install & Verify Ops Agent for Logging and Monitoring in Google Cloud Platform (GCP)." Latchu@DevOps | Sciencx - Accessed . 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/
IEEE
" » Part-20: ๐Ÿš€ Google Cloud Compute Engine โ€“ Install & Verify Ops Agent for Logging and Monitoring in Google Cloud Platform (GCP)." Latchu@DevOps | Sciencx [Online]. Available: 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/. [Accessed: ]
rf:citation
» Part-20: ๐Ÿš€ Google Cloud Compute Engine โ€“ Install & Verify Ops Agent for Logging and Monitoring in Google Cloud Platform (GCP) | Latchu@DevOps | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.