You cannot fix what you cannot see. google cloud monitoring — formerly known as Stackdriver — collects metrics, logs, uptime signals, and traces from your Google Cloud resources and turns them into dashboards and alerts. Without it, the first sign of an outage is usually an unhappy customer. This guide walks you through installing the agent, building a dashboard, creating uptime checks, and alerting on real problems. This article covers How to Set Up Google Cloud in detail.
The setup below uses a single Compute Engine VM and a public website as examples, but the same patterns scale to fleets of servers and dozens of services.
Prerequisites – How to Set Up Google Cloud
- A Google Cloud project with billing enabled and the Monitoring API enabled.
- A Compute Engine VM running a supported Linux distribution, with SSH access.
- Permissions to edit monitoring dashboards, uptime checks, and alerting policies, typically roles/monitoring.editor.
- A website or HTTP endpoint you want to check from outside Google Cloud.
If you already monitor Linux hosts with tools such as Netdata for real-time Linux monitoring or a self-hosted Zabbix server on Ubuntu, Cloud Monitoring complements them by watching your services from Google’s global checkpoints and correlating signals inside GCP.
Step 1: Install the Cloud Ops Agent for Google Cloud Monitoring – How to Set Up Google Cloud
Some metrics, such as CPU and network, are reported automatically by Compute Engine. Memory and disk usage inside the guest are not — the VM knows them, but the hypervisor does not. The Cloud Ops Agent closes that gap and also ships system logs.
curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh
sudo bash add-google-cloud-ops-agent-repo.sh --also-install
Verify that the agent is running and check its recent output before moving on:
sudo systemctl status google-cloud-ops-agent
sudo journalctl -u google-cloud-ops-agent --no-pager -n 30

Key metrics you get
Once google cloud monitoring receives agent data, you can chart CPU utilisation, memory utilisation, disk usage and I/O, network bytes and packets, process counts, and swap usage, alongside platform metrics for load balancers, Cloud SQL, and other managed services. The full metric catalogue is described in the Google Cloud Monitoring documentation.
Step 2: Create a Dashboard with Charts
In the console, open Monitoring > Dashboards > Create Dashboard. Add a chart, choose the resource type VM Instance, and select a metric such as agent.googleapis.com/memory/percent_used. Add a second chart for compute.googleapis.com/instance/cpu/utilization and a third for disk usage. Name charts plainly, set a sensible refresh interval, and save the dashboard with a name your team will recognise at 3 a.m. Dashboards are also manageable as JSON, which makes them easy to version in Git once the layout works.
Google Cloud Monitoring Uptime Checks for Your Website
An uptime check probes your site from multiple Google locations on a schedule and records success, latency, and status code. Go to Monitoring > Uptime checks > Create Uptime Check, choose HTTP or HTTPS, and enter the hostname and path — for most sites the path is simply /. Set the check frequency, for example every 1 or 5 minutes, choose at least three checker regions so a single regional network problem does not look like a site outage, and set a timeout that reflects a realistic page response, often 10 seconds. Save and wait for the first results: a healthy check turns green in all selected regions.
Step 3: Create an Alerting Policy
Dashboards help humans investigate; alerting policies wake them up. Create one policy for host health and one for availability.
CPU alert example
Under Monitoring > Alerting > Create Policy, add a condition on VM CPU utilisation with a threshold above 80 percent, sustained for 5 minutes, aggregated across the instance. The duration matters: a one-minute compile spike should not page anyone, but five minutes of saturation usually means real pressure.
Uptime check failure alert
Add a second policy based on the uptime check metric, alerting when the check fails in two or more regions for consecutive evaluations. Requiring multiple regions keeps the signal trustworthy and avoids alerts caused by one checker location.
Step 4: Configure Notification Channels
Under Monitoring > Alerting > Notification Channels, add an email channel for the on-call address and verify it. For chat, add a Slack channel or a generic webhook endpoint your incident tool provides. Attach the channels to each policy, write a clear alert name such as “Production website down — uptime check failing”, and include short documentation in the policy describing the first checks to run. An alert without a next step creates panic, not resolution.
Log-Based Metrics Basics
Some important signals live only in logs: repeated 500 errors, failed logins, or a specific application error string. In Cloud Logging, filter for the pattern, choose Create Metric, and give it a name. That counter becomes a normal metric you can chart and alert on, bridging the gap between raw logs and operational alerting without extra tooling.
Step 5: Verify Alerts with a Test Failure
Never trust an untested alert. Stop a test web service, block the checked path, or point a temporary uptime check at a non-existent URL, then confirm three things: the policy fires within the expected window, the notification actually arrives in email or Slack, and the alert auto-resolves or can be acknowledged cleanly after you restore service. Record the test in your runbook so the next engineer repeats it after any monitoring change.
Troubleshooting
Ops Agent is not reporting
Check the service first with systemctl status, then check identity permissions. The VM’s service account needs roles/logging.logWriter and roles/monitoring.metricWriter. Without them the agent runs but cannot deliver data. Also confirm the VM can reach Google APIs and that the agent version supports your distribution.
Uptime check fails but the site is up
Open the check details and look at which regions fail and which status code they receive. A redirect to a login page, a bot filter blocking checker addresses, a wrong path, or an expired certificate in one region’s view can all produce this pattern while real users are fine. Fix the path or expected status code rather than deleting the check.
Conclusion
With the Ops Agent installed, a focused dashboard, external uptime checks, and tested alerting policies, google cloud monitoring gives you early, trustworthy warning instead of surprises. Start with CPU, memory, disk, and one uptime check, prove the notifications work, and then expand coverage service by service.