Puy Web
Profile Blog
EN TH
Blog Monitoring in Google Cloud: Challenge Lab
Monitoring in Google Cloud: Challenge Lab
Technology Mar 26, 2026

Monitoring in Google Cloud: Challenge Lab

Let learn about monitoring in google cloud via challenge lab.

Challenge scenario

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.

Let start the lab.

Task 1. Install the Cloud Logging and Monitoring agents

  1. Go to Compute Engine > VM Instances.

  2. Click SSH button on the provisioned VM.

  3. Install the logging agent.

    curl -sSO https://dl.google.com/cloudagents/add-logging-agent-repo.sh
    sudo bash add-logging-agent-repo.sh --also-install
  4. Install the monitoring agent.

    curl -sSO https://dl.google.com/cloudagents/add-monitoring-agent-repo.sh
    sudo bash add-monitoring-agent-repo.sh --also-install
  5. Enable the Apache Web Server monitoring plugin.

    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

Task 2. Add an uptime check for Apache Web Server on the VM

  1. Go to search bar, "Uptime checks" Under Monitoring

  2. Click + Create Uptime Check button

  3. Config with these settings:

    • Protocol: HTTP

    • Resource Type: URL

    • Hostname: (External IP of VM from Task 1.)

    • Path: /

  4. Click continue.

  5. Click Test for validation, Once it returns a "200 OK", click Create.

Task 3. Add an alert policy for Apache Web Server

  1. Generate Test Traffic by switch to VM's SSH terminal window. and run this command. It will generate network traffic for alert policy can trigger.

    timeout 120 bash -c -- 'while true; do curl localhost | grep -oP ".*"; sleep .1s;done'
  2. Go back to Cloud Console, go to search bar, "Alerting" under Monitoring

  3. Click + Create Policy button

  4. Select metric dropdown:

    • Uncheck the "Active" toggle.

    • Type "traffic" in search bar

    • Nagivate to VM Instance > Apache > Network traffic

    • Click Apply

  5. Configure the Condition

    • Condition Type: Threshold

    • Threshold position: Above threshold

    • Threshold value: 3072 (3 KiB/s in bytes)

    • Click Next.

  6. Configure Notifications:

    • Click on drop-down for Notification Channels and select Manage Notification Channels

    • Scroll down to Email and click Add New

    • Enter personal email or alternative email for receive alert email, give a display name like "Email Address" or related, and click Save.

    • Go back to Alerting tab, select a newly added email, and click OK.

  7. Name the alert policy like "Apache Traffic Alert" or anything, and click Create Policy.

Task 4. Create a dashboard and charts for Apache Web Server on the VM

  1. Go to search bar, "Dashboard" under Monitoring.

  2. Click + Create Dashboard.

  3. Add first chart (Title: CPU Load):

    • Click + Add Widget and select Line Chart.

    • In the Metric search box, type CPU load (1m).

    • Select the metric under VM Instance > CPU and click Apply.

  4. Add second chart (Title: Apache Requests):

    • Click + Add Widget and select Line Chart.

    • Uncheck "Active" toggle, In Metric search box, type Requests.

    • Select the metric under VM Instance > Apache > Requests and click Apply

Task 5. Create a log-based metric

  1. In search bar, "Logs Explorer".

  2. Select filters:

    • Resource Type: VM Instance

    • Log Metric: apache-access

    • Add textPayload:"200" on query editor

    • Click Actions button on right area.

    • Click Create metric

    • Metric Type: Counter

    • Log metric name: apache-access

Congratulations. Complete the lab.

Share this article:

Related Articles

Journey Log: Setup & Deploy Web App / API / Let's Encrypt on VPS with Dockers and Auto Deploy from GitLab Container Registry
Technology
Apr 20, 2026

Journey Log: Setup & Deploy Web App / API / Let's Encrypt on VPS with Dockers and Auto Deploy from GitLab Container Registry

This blog is a content for setup & deploy web application and api service with dockerize on VPS, with auto deploy if found new image registry.

Read More
Engineer Data for Predictive Modeling with BigQuery ML: Challenge Lab
Technology
Apr 14, 2026

Engineer Data for Predictive Modeling with BigQuery ML: Challenge Lab

Let learn through the lab.

Read More
Implement Multimodal Vector Search with BigQuery: Challenge Lab
Technology
Apr 13, 2026

Implement Multimodal Vector Search with BigQuery: Challenge Lab

Let learn through the challenge lab.

Read More
Perform Predictive Data Analysis in BigQuery: Challenge Lab
Technology
Apr 12, 2026

Perform Predictive Data Analysis in BigQuery: Challenge Lab

Let learn throught the challenge lab.

Read More