📖 Scenario: You are working as a cloud engineer for a small company that wants to improve its cloud operations on Google Cloud Platform (GCP). The company wants to set up a simple monitoring and alerting system to ensure their application runs smoothly and any issues are quickly detected and resolved.
🎯 Goal: Build a basic Google Cloud Monitoring setup that includes a metric descriptor, an alerting policy, and a notification channel to achieve operational excellence by monitoring uptime and sending alerts.
📋 What You'll Learn
Create a custom metric descriptor for tracking application uptime
Configure a notification channel for email alerts
Set up an alerting policy that triggers when uptime drops below 99%
Use clear and exact resource names and values as specified
💡 Why This Matters
🌍 Real World
Monitoring uptime and setting alerts is critical for maintaining reliable cloud applications and quickly responding to issues.
💼 Career
Cloud engineers and DevOps professionals use monitoring and alerting to ensure operational excellence and meet service level objectives.
Progress0 / 4 steps
1
Create a custom metric descriptor for uptime
Create a variable called uptime_metric_descriptor that holds a dictionary with these exact keys and values: name set to "custom.googleapis.com/application/uptime", type set to "GAUGE", and description set to "Tracks application uptime percentage".
GCP
Hint
Use a Python dictionary with keys exactly as name, type, and description.
2
Configure an email notification channel
Create a variable called email_notification_channel that holds a dictionary with these exact keys and values: type set to "email", and email_address set to "alerts@example.com".
GCP
Hint
Use a dictionary with keys type and email_address exactly as shown.
3
Set up an alerting policy for uptime
Create a variable called alert_policy that holds a dictionary with these exact keys and values: display_name set to "Uptime Alert", condition set to a nested dictionary with metric equal to "custom.googleapis.com/application/uptime" and threshold equal to 99, and notification_channels set to a list containing the string "email_notification_channel".
GCP
Hint
Use nested dictionaries for condition and a list for notification_channels.
4
Complete the monitoring configuration
Add a variable called monitoring_configuration that holds a dictionary with these exact keys and values: metric_descriptor set to the variable uptime_metric_descriptor, notification_channel set to the variable email_notification_channel, and alert_policy set to the variable alert_policy.
GCP
Hint
Combine the previous variables into one dictionary for the full monitoring setup.
Practice
(1/5)
1. What is the main goal of operational excellence in cloud systems?
easy
A. Keep systems healthy and reliable
B. Write complex code
C. Reduce cloud costs only
D. Avoid using monitoring tools
Solution
Step 1: Understand operational excellence purpose
Operational excellence focuses on keeping cloud systems running well and reliable.
Step 2: Compare options with this goal
Only Keep systems healthy and reliable matches this goal; others focus on unrelated tasks.
Final Answer:
Keep systems healthy and reliable -> Option A
Quick Check:
Operational excellence = system health and reliability [OK]
Hint: Operational excellence means system health and reliability [OK]
Common Mistakes:
Confusing cost reduction with operational excellence
Thinking it means writing complex code
Ignoring monitoring and alerts
2. Which GCP service is used to monitor cloud resources and send alerts?
easy
A. Cloud Monitoring
B. Cloud Storage
C. Cloud Functions
D. Cloud SQL
Solution
Step 1: Identify monitoring service in GCP
Cloud Monitoring is designed to track resource health and send alerts.
Low disk space alert should trigger when disk usage is high, so comparison should be greater than.
Step 2: Check comparison operator
COMPARISON_LT triggers when usage is less than threshold, opposite of intent.
Final Answer:
Using COMPARISON_LT instead of COMPARISON_GT -> Option B
Quick Check:
Low disk space needs COMPARISON_GT [OK]
Hint: Low disk space alert needs COMPARISON_GT, not LT [OK]
Common Mistakes:
Using less than instead of greater than
Misunderstanding metric meaning
Ignoring alert duration importance
5. Your team wants to improve operational excellence by automating recovery when a VM instance becomes unresponsive. Which GCP service combination best supports this goal?
hard
A. Cloud Storage + Cloud SQL for backups
B. Cloud Pub/Sub + BigQuery for data analysis
C. Cloud Monitoring + Cloud Functions to restart VM automatically
D. Cloud Run + App Engine for hosting apps
Solution
Step 1: Identify automation for recovery
Cloud Monitoring detects issues; Cloud Functions can run code to fix problems automatically.
Step 2: Evaluate other options
Cloud Storage and SQL are for data, Pub/Sub and BigQuery for messaging and analysis, Cloud Run and App Engine for app hosting, not recovery automation.
Final Answer:
Cloud Monitoring + Cloud Functions to restart VM automatically -> Option C