Google Cloud Platform - Creating a Cloud Monitor
Last Updated :
01 Feb, 2021
Cloud monitoring is the process of reviewing and managing the operational workflow and processes within a cloud infrastructure or asset. These techniques confirm the performance of websites, servers, applications, and other cloud infrastructure.
The following steps create the monitor in the Google cloud console.
Step 1: Create a Compute Engine instance :
Navigation menu --> Compute Engine --> VM instances --> Create.
Field | Value |
---|
Name | GeeksforGeeks |
Region | us-central1 (Iowa) |
Zone | us-central-a |
Series | N1 |
Machine type | n1-standard-2 |
Firewall | check allow HTTP traffic |
Step 2: Add Apache2 HTTP Server to your instance
In the SSH of created instance, the following commands will set up Apache2 HTTP Server.
sudo apt-get update
sudo apt-get install apache2 php7.0
sudo service apache2 restart
To verify the setup, go to the external IP and view the successful deployment of the server.
Step 3: Create a Monitoring workspace
Navigation menu --> Monitoring
Run the Monitoring agent install script command in the SSH terminal of your VM instance to install the Cloud Monitoring agent.
curl -sSO https://dl.google.com/cloudagents/add-monitoring-agent-repo.sh
sudo bash add-monitoring-agent-repo.sh
sudo apt-get update
sudo apt-get install stackdriver-agent
Run the Logging agent install script command in the SSH terminal of your VM instance to install the Cloud Logging agent
curl -sSO https://dl.google.com/cloudagents/add-logging-agent-repo.sh
sudo bash add-logging-agent-repo.sh
sudo apt-get install google-fluentd
Step 4: Create an uptime check
Cloud Console --> Uptime checks (in the left menu) --> Create Uptime Check
Set the following fields:
Title: GFG Uptime Check, then click Next.
Protocol: HTTP
Resource Type: Instance
Applies to: Single, geeksforgeeks
Path: leave at default
Check Frequency: 1 min
After entering all the necessary fields, click "TEST" . If it responds the way depicted in the below picture, click "CREATE".
Step 5: Create an alerting policy
- In the left menu, click Alerting, and then click Create Policy.
- Click Add Condition.
- Set the following in the panel that opens:
- Target: Start typing "VM" in the resource type and metric field, and then select:
- Resource Type: VM Instance (gce_instance)
- Metric: Type "network"
Step 6: Now select Network traffic (gce_instance+1). Be sure to choose the Network traffic resource with agent.googleapis.com/interface/traffic:
- Configuration
- Condition: is above
- Threshold: 500
- For: 1 minute
- Click ADD.
Step 7: Click on Next.
Step 8: Click on drop-down arrow next to Notification Channels, then click on Manage Notification Channels.
Step 9: Scroll down the page and click on ADD NEW for Email.
Step 10: In Create Email Channel dialog box, enter your personal email address in the Email Address field and a Display name. Click on Save.
Step 11: Go back to the previous Create alerting policy tab.
Step 12: Click on Notification Channels again, then click on the Refresh icon to get the display name you mentioned in the previous step.
Step 13: Now, select your Display name and click OK. Click Next.
Step 14: Mention the Alert name as Inbound Traffic Alert.
Step 15: Add a message in the documentation, which will be included in the emailed alert. Click on Save.
You've created an alert! While you wait for the system to trigger an alert, create a dashboard and chart, and then check out Cloud Logging.

Create a dashboard and chart
To display the metrics collected by Cloud Monitoring create your own charts and dashboards. In this section, you create the charts for the lab metrics and a custom dashboard.
Step 1: In the left menu select Dashboards, and then Create Dashboard.
Step 2: Name the dashboard Cloud Monitoring GeeksforGeeks.
Step 3: Add the first chart and Click the Line option in the Chart library.
Step 4: Name the chart title CPU Load.
Step 5: Set the Resource type to VM Instance.
Step 6: Set the Metric CPU load (1m). Refresh the tab to view the graph.

View your logs
Cloud Monitoring and Cloud Logging are closely integrated. Check out the logs for your lab.
Select Navigation menu --> Logging --> Logs Explorer.
Select the logs you want to see, in this case, you select the logs for the geeksforgeeks instance you created at the start of this lab:
Resource --> VM instances --> geeksforgeeks
Step 1: Click "ADD"
Step 2: Click "Stream logs"
Step 3: You see the logs for your VM instance
Step 4: Open the Compute Engine window in a new browser window.
Select Navigation menu --> Compute Engine, right-click VM-instances --> Open link in new window.
Step 5: Move the Logs Viewer browser window next to the Compute Engine window. This makes it easier to view how changes to the VM are reflected in the logs.
Step 6: In the Compute Engine window, select the geeksforgeeks instance, click Stop at the top of the screen, and then confirm to stop the instance.
Step 7: Watch in the Logs View tab for when the VM is stopped.
Step 8: In the VM instance details window, click Start at the top of the screen, and then confirm. It will take a few minutes for the instance to re-start. Watch the log messages to monitor the startup.
Similar Reads
Google Cloud vs IBM Cloud: Comparing Cloud Platforms
To be productive in todayâs business world, you must have noticed that cloud computing has become the World Wide Webâs Holy Grail. This implies that choosing the right cloud provider is not a matter of preference but mandatory since you need operational agility as data surges. In this detailed exami
9 min read
Cloud Storage in Google Cloud Platform (GCP)
Google Cloud Storage is a secure, scalable, and high-performance storage solution that lets businesses store, manage, and retrieve data effortlessly. Itâs designed for big data analytics, media storage, backups, and disaster recovery, making it a go-to option for enterprises looking for cost-effecti
8 min read
Google Cloud Platform - MemoryStore
Memorystore is GCP's service that helps to build blazingly fast applications. Memorystore is a Fully manages in-memory service. It can automate complex tasks simultaneously providing top-notch security by integrating IAM protocols without increasing application latency. Fully managed structure of Me
2 min read
Google Cloud Platform - Filestore
GCP's Filestore is a managed file storage service for applications that require a file system interface and a shared file system for data. It gives the user a native experience for standing up managed network detached storage with their VM in the compute engine and Google Kubernetes Engine. It offer
3 min read
Google Cloud Platform - Cloud Storage
Google Cloud Storage is unified object storage. In reality, the GCS is the place where you can store and serve static binary assets either for your app to use or directly to your users. But as straightforward, as it sounds, there is a lot going under the hood. Google Cloud Storage The GCP has Bucket
2 min read
Google Cloud Monitoring & Google Cloud Logging
In cloud computing, handling and tracking the performance of your infrastructure is important for ensuring optimal functionality, identifying troubles, and retaining the overall health of your packages. Google Cloud Platform (GCP) provides robust tools for tracking and logging, offering customers pr
8 min read
Google Cloud Platform - Overview of G Suite APIs
Many of you know how to use Gmail, Google Drive, and Docs, and that's great. But can you code them too? In this article we aim to learn about G Suite as another tool, giving you the ability to code those apps you know so well. Productivity tools like a word processor, spreadsheets, and presentation
5 min read
What is Google Cloud Platform (GCP)?
Google Cloud Platform (GCP) is a cloud computing service by Google that helps businesses, developers, and enterprises run applications, store data, and manage workloads on a secure, scalable, and high-performance infrastructure. Whether you're building a website, handling large datasets, or running
15+ min read
Google Cloud Platform - GCS Buckets
In this article, we will look into Buckets and why they are the Cornerstone of Google Cloud Storage(GCS) in everything you do on GCS. Before you can do anything on Google Cloud Storage, you have to create a Bucket as anything you want to store in the GCS need to be stored inside a bucket in order to
4 min read
Google Cloud Platform - Compute Services
To create and run a Virtual Machine in the Google Cloud Platform, one needs Compute Services to perform certain operations. Google Cloud Platformâs Compute Engine provides a variety of computing options according to usersâ needs. Whether youâre looking for virtual machines, serverless or a managed p
8 min read