Monitoring in Google Cloud: Challenge Lab - ARC115

A passionate full-stack developer from @ePlus.DEV
Search for a command to run...

A passionate full-stack developer from @ePlus.DEV
No comments yet. Be the first to comment.
Quick and practical tips to help users optimize tasks, improve skills, and solve common problems effectively across various areas like tech, lifestyle, productivity, and more.
Một bản tin giúp Developer cập nhật nhanh AI, Cloud, Open Source và những công nghệ đáng chú ý trong ngày. 📌 Executive Summary Google Cloud công bố roadmap Post-Quantum Cryptography hướng tới full

Một bản tin giúp Developer cập nhật nhanh AI, Cloud, Open Source và những công nghệ đáng chú ý trong ngày. 📌 Executive Summary Google Cloud ra mắt Developer Device Platform (DDP) ở Public Preview,

Một bản tin giúp Developer cập nhật nhanh AI, Cloud, Open Source và những công nghệ đáng chú ý trong ngày. 📌 Executive Summary Vercel AI Gateway thêm Grok Imagine Image 2.0 Preview, đưa image gene

Một bản tin giúp Developer cập nhật nhanh AI, Cloud, Open Source và những công nghệ đáng chú ý trong ngày. 📌 Executive Summary Cloudflare đang hợp nhất Workers AI và AI Gateway thành một control p

Một bản tin giúp Developer cập nhật nhanh AI, Cloud, Open Source và những công nghệ đáng chú ý trong ngày. 📌 Executive Summary GitHub thay đổi hành vi của Code Quality: bật Code Quality sẽ không c

In a challenge lab you’re given a scenario and a set of tasks. Instead of following step-by-step instructions, you will use the skills learned from the labs in the course to figure out how to complete the tasks on your own! An automated scoring system (shown on this page) will provide feedback on whether you have completed your tasks correctly.
When you take a challenge lab, you will not be taught new Google Cloud concepts. You are expected to extend your learned skills, like changing default values and reading and researching error messages to fix your own mistakes.
To score 100% you must successfully complete all tasks within the time period!
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.
This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Note: Use an Incognito (recommended) or private browser window to run this lab. This prevents conflicts between your personal account and the student account, which may cause extra charges incurred to your personal account.
Note: Use only the student account for this lab. If you use a different Google Cloud account, you may incur charges to that account.
As a junior cloud engineer, you are part of a team of people assigned to manage Google Cloud resources in your organization. One of your job requirements in this role is to use the Cloud Logging and Cloud Monitoring services to monitor Apache Web Server activities installed on a virtual machine (VM) instance.
You are expected to have the skills and knowledge for the tasks that follow.
For this challenge, you have been tasked with installing the Cloud Monitoring and Cloud Logging agents on the VM via SSH, create an alert policy for Apache Web Server, set uptime checks for the VM, configure a dashboard, and add a log-based metric for the server that's installed on the VM.
You need to:
Install the Cloud Monitoring and Cloud Logging agents.
Add an uptime check and alert policy for Apache Web Server.
Create a dashboard and chart for the VM and Apache Web Server each.
Create a log-based metric.
For this challenge lab, a virtual machine (VM) instance named apache-vm has been configured that has Apache Web Server installed for you to complete the tasks.
You can verify the server is running by clicking on the External IP of the VM.
Each task is described in detail below, good luck!
Note: With the Cloud Logging agent not yet installed, if you check for Apache Web Server logs in Cloud Logging, you will only see audit logs; no Apache Web Server logs (although Apache Web Server is configured on the VM instance). Similarly, if you try to check metrics for Apache Web Server in the Metric Explorer it will not show any data.
So for this task, you need to install the Cloud Logging and Cloud Monitoring agents.
Connect to the VM instance apache-vm provisioned for you via SSH and install the Cloud Logging and Cloud Monitoring agents.
Enable the Apache Web Server monitoring plugin using the following commands:
(cd /etc/stackdriver/collectd.d/ && sudo curl -O https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/collectd.d/apache.conf)
sudo service stackdriver-agent restart
Click Check my progress to verify the objective.
Install the Cloud Logging and Cloud Monitoring agents
instance.Note: The uptime check that you configure may take a while to become active. Continue with the lab, you can check the uptime results later.
Click Check my progress to verify the objective.
Add an uptime check for Apache Web Server on the VM
Create an alert policy for Apache Web Server traffic that notifies you on your personal email account when the traffic rate exceeds 3 KiB/s.
Connect to the instance via SSH and run the following command to generate the traffic:
timeout 120 bash -c -- 'while true; do curl localhost | grep -oP "<title>.*</title>"; sleep .1s;done '
Copied!
Click Check my progress to verify the objective.
Add an alert policy for Apache Web Server
Note: If you do not receive an email immediately, try to increase the load on the VM by executing the command in step 2 again.
For this task, you need to create a dashboard that's configured with charts.
Add the first line chart that has a Resource metric filter, CPU load (1m), for the VM.
Add a second line chart that has a Resource metric filter, Requests, for Apache Web Server.
Click Check my progress to verify the objective.
Create a dashboard and charts for Apache Web Server on the VM
Next, create a log based metric that filters for the following values:
| Filter | Values |
|---|---|
| Resource type | VM |
| Logname | apache-access |
| Text Payload | textPayload:"200" |
Explore the log-based metrics by selecting the metric VM Instance > Apache > Request.
Click Check my progress to verify the objective.
Create a log-based metric
curl -LO raw.githubusercontent.com/ePlus-DEV/storage/refs/heads/main/labs/ARC115/lab.sh
source lab.sh
Script Alternative
curl -LO https://raw.githubusercontent.com/Itsabhishek7py/GoogleCloudSkillsboost/refs/heads/main/Monitoring%20in%20Google%20Cloud%3A%20Challenge%20Lab/abhishek.sh
sudo chmod +x abhishek.sh
./abhishek.sh
Task 3. Add an alert policy for Apache Web Server
Create log-based metric from hereFor Log-based metric name: enter drabhi
Paste The Following in Build filter & Replace PROJECT_ID
resource.type="gce_instance"
logName="projects/PROJECT_ID/logs/apache-access"
textPayload:"200"
Task 4. Create a dashboard and charts for Apache Web Server on the VM
CPU load (1m)
Requests