0
0
GCPcloud~30 mins

Metrics and dashboards in GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
Create a Custom Metrics Dashboard in GCP
📖 Scenario: You are a cloud engineer at a company using Google Cloud Platform (GCP). Your team wants to monitor the CPU usage of virtual machines to ensure they run smoothly without overload.You will create a custom metric and then build a dashboard to visualize this metric.
🎯 Goal: Build a custom metric in GCP to track CPU usage and create a dashboard that displays this metric clearly.
📋 What You'll Learn
Create a custom metric descriptor for CPU usage
Set a threshold value for CPU usage alert
Write a query to fetch CPU usage data
Configure a dashboard widget to display the CPU usage metric
💡 Why This Matters
🌍 Real World
Monitoring VM CPU usage helps prevent performance issues and downtime by alerting teams before problems occur.
💼 Career
Cloud engineers and DevOps professionals often create custom metrics and dashboards to maintain healthy cloud infrastructure.
Progress0 / 4 steps
1
Create a custom metric descriptor
Create a custom metric descriptor named custom.googleapis.com/vm_cpu_usage with a description CPU usage percentage of VM instances and a metric type of GAUGE.
GCP
Need a hint?

Use the exact metric name custom.googleapis.com/vm_cpu_usage and set the type to GAUGE.

2
Set a CPU usage alert threshold
Create a variable named cpu_alert_threshold and set it to 80 to represent 80% CPU usage as the alert threshold.
GCP
Need a hint?

Set cpu_alert_threshold exactly to 80.

3
Write a query to fetch CPU usage data
Write a variable named cpu_usage_query that contains the Monitoring Query Language (MQL) query string to fetch the custom.googleapis.com/vm_cpu_usage metric data for the last 5 minutes.
GCP
Need a hint?

Use the exact query string 'fetch custom.googleapis.com/vm_cpu_usage | within 5m'.

4
Configure a dashboard widget for CPU usage
Create a dictionary named dashboard_widget with keys title set to "CPU Usage", type set to "line_chart", and query set to the variable cpu_usage_query.
GCP
Need a hint?

Use the exact keys and values as specified, and assign cpu_usage_query to the query key.