0
0
GCPcloud~30 mins

Alerting policies in GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
Creating a Basic Alerting Policy in GCP
📖 Scenario: You are managing a Google Cloud Platform project and want to be notified when your virtual machine CPU usage is too high. To do this, you will create an alerting policy that watches CPU utilization and sends an email notification if it goes above a certain limit.
🎯 Goal: Build a simple alerting policy in Google Cloud Monitoring that triggers when CPU usage exceeds 80% for a virtual machine instance.
📋 What You'll Learn
Create a metric threshold condition for CPU utilization
Set the threshold value to 80%
Configure the alerting policy with a notification channel
Name the alerting policy clearly
💡 Why This Matters
🌍 Real World
Alerting policies help cloud administrators get notified about important issues like high CPU usage, so they can act quickly to maintain system health.
💼 Career
Understanding how to create and configure alerting policies is essential for cloud engineers and site reliability engineers to ensure system reliability and uptime.
Progress0 / 4 steps
1
Define the CPU Utilization Metric Condition
Create a dictionary called cpu_condition with these exact keys and values: displayName set to "VM CPU Utilization", conditionThreshold as a nested dictionary with filter set to "metric.type=\"compute.googleapis.com/instance/cpu/utilization\"", comparison set to "COMPARISON_GT", thresholdValue set to 0.8, and duration set to "60s".
GCP
Need a hint?

Use a dictionary with nested dictionaries to define the metric condition.

2
Create the Notification Channel Configuration
Create a dictionary called notification_channel with the key type set to "email" and the key labels set to a dictionary with email_address set to "alert@example.com".
GCP
Need a hint?

Notification channels use a dictionary with type and labels keys.

3
Build the Alerting Policy Dictionary
Create a dictionary called alert_policy with the key displayName set to "High CPU Usage Alert", the key conditions set to a list containing the cpu_condition dictionary, and the key notificationChannels set to a list containing the string "email-alert-channel".
GCP
Need a hint?

Use a dictionary with keys displayName, conditions, and notificationChannels.

4
Add Documentation and Finalize the Alerting Policy
Add a key documentation to the alert_policy dictionary with a nested dictionary containing content set to "Alert when VM CPU usage exceeds 80% for 1 minute." and mimeType set to "text/markdown".
GCP
Need a hint?

Documentation helps explain the alert policy purpose.