Install the Logging and Monitoring agents on Linux VM

Check my progress

/ 20

Add an uptime check for Apache VM

Check my progress

/ 20

Add an alert policy for Apache Server

Check my progress

/ 20

Create a dashboard and chart for Apache VM

Check my progress

/ 20

Create logs-based metric

Check my progress

/ 20

This lab may incorporate AI tools to support your learning.

ARC115

Google Cloud 自學實驗室

總覽

在挑戰研究室中,您會在特定情境下完成一系列任務。挑戰研究室不會提供逐步說明,您將運用從課程研究室學到的技巧,自行找出方法完成任務!自動評分系統 (如本頁所示) 將根據您是否正確完成任務來提供意見回饋。

在您完成任務的期間,挑戰研究室不會介紹新的 Google Cloud 概念。您須靈活運用所學技巧,例如變更預設值或詳讀並研究錯誤訊息,解決遇到的問題。

若想滿分達標,就必須在時限內成功完成所有任務!

設定和需求

瞭解以下事項後,再點選「Start Lab」按鈕

請詳閱以下操作說明。實驗室活動會計時,且中途無法暫停。點選「Start Lab」後就會開始計時,顯示可使用 Google Cloud 資源的時間。

您將在真正的雲端環境完成實作實驗室活動,而不是模擬或示範環境。為此,我們會提供新的暫時憑證,供您在實驗室活動期間登入及存取 Google Cloud。

為了順利完成這個實驗室,請先確認:

  • 可以使用標準的網際網路瀏覽器 (Chrome 瀏覽器為佳)。
注意事項:請使用無痕模式 (建議選項) 或私密瀏覽視窗執行此實驗室,這可以防止個人帳戶和學員帳戶之間的衝突,避免個人帳戶產生額外費用。
  • 是時候完成實驗室活動了!別忘了,活動一旦開始將無法暫停。
注意事項:務必使用實驗室專用的學員帳戶。如果使用其他 Google Cloud 帳戶,可能會產生額外費用。

挑戰情境

您是初階雲端工程師,隸屬於管理貴組織 Google Cloud 資源的團隊。您的其中一項職務是使用 Cloud Logging 和 Cloud Monitoring 服務,監控安裝於虛擬機器 (VM) 執行個體的 Apache 網路伺服器活動。

您應具備完成下列工作所需的技能與知識。

您的挑戰

您需要透過 SSH 在 VM 安裝 Cloud Monitoring 和 Cloud Logging 代理程式,並為 VM 上的 Apache 網路伺服器建立警告政策、運作時間檢查、資訊主頁和記錄指標。

您的任務:

  • 安裝 Cloud Monitoring 和 Cloud Logging 代理程式。
  • 為 Apache 網路伺服器新增運作時間檢查和警告政策。
  • 為 VM 和 Apache 網路伺服器分別建立資訊主頁和圖表。
  • 建立記錄指標。

在本挑戰實驗室,我們已設定虛擬機器 (VM) 執行個體 ,並安裝 Apache 網路伺服器供您完成工作。

點選 VM 的 External IP,即可確認伺服器是否正在執行。

各項工作的詳細說明如下,祝您順利!

工作 1:安裝 Cloud Logging 和 Monitoring 代理程式

注意:即使已為 VM 執行個體設定 Apache 網路伺服器,但由於尚未安裝 Cloud Logging 代理程式,您在 Cloud Logging 只能看到稽核記錄,無法看到伺服器記錄。同理,如果您在 Metrics Explorer 查看 Apache 網路伺服器的指標,系統也不會顯示任何資料。

因此在這項工作,您必須安裝 Cloud Logging 和 Cloud Monitoring 代理程式。

  1. 透過 SSH 連線至為您佈建的 VM 執行個體 ,然後安裝 Cloud Logging 和 Cloud Monitoring 代理程式。

  2. 執行下列指令,啟用 Apache 網路伺服器監控外掛程式:

(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

點選「Check my progress」,確認目標已達成。 安裝 Cloud Logging 和 Cloud Monitoring 代理程式

工作 2:為 VM 中的 Apache 網路伺服器新增運作時間檢查

  • 在這項工作,您必須確認 VM 已啟動並正常運作,為此,請使用 VM 的外部 IP 位址,建立資源類型設為 URL 的運作時間檢查。
注意:運作時間檢查設定完畢後,可能需要一些時間才會生效。請先繼續使用實驗室,稍後再查看結果。

點選「Check my progress」,確認目標已達成。 為 VM 中的 Apache 網路伺服器新增運作時間檢查

工作 3:為 Apache 網路伺服器新增警告政策

  1. 為 Apache 網路伺服器的流量建立警告政策,當流量速率超過 3 KiB/s 時,您的個人電子郵件帳戶就會收到通知。

  2. 透過 SSH 連線至執行個體,然後執行下列指令來產生流量:

timeout 120 bash -c -- 'while true; do curl localhost | grep -oP ".*"; sleep .1s;done '
  1. 監控剛剛建立的警告政策,如果流量速率超過 3 KiB/s,您的電子郵件帳戶應會收到警告。

點選「Check my progress」,確認目標已達成。 為 Apache 網路伺服器新增警告政策

注意:如果沒有立即收到電子郵件,請再次執行步驟 2 的指令,嘗試增加 VM 的負載。

工作 4:為 VM 中的 Apache 網路伺服器建立資訊主頁和圖表

在這項工作,您必須建立有圖表的資訊主頁。

  1. 新增第一個折線圖,其中包含 VM 的資源指標篩選器 CPU load (1m)

  2. 新增第二個折線圖,其中包含 Apache 網路伺服器的資源指標篩選器 Request

點選「Check my progress」,確認目標已達成。 為 VM 中的 Apache 網路伺服器建立資訊主頁和圖表

工作 5:建立記錄指標

  1. 接著建立記錄指標,篩選出下列值:

    篩選條件
    資源類型 VM
    記錄檔名稱 apache-access
    文字酬載 textPayload:"200"
  2. 依序選取「VM 執行個體」>「Apache」>「要求」,查看記錄指標。

點選「Check my progress」,確認目標已達成。 建立記錄指標

恭喜!

「Google Cloud 監控工具」技能徽章

您已成功在 VM 安裝 Cloud Logging 和 Cloud Monitoring 代理程式,並為專案的 Apache 網路伺服器建立警告政策、資訊主頁與記錄指標。

Google Cloud 教育訓練與認證

協助您瞭解如何充分運用 Google Cloud 的技術。我們的課程會介紹專業技能和最佳做法,讓您可以快速掌握要領並持續進修。我們提供從基本到進階等級的訓練課程,並有隨選、線上和虛擬課程等選項,方便您抽空參加。認證可協助您驗證及證明自己在 Google Cloud 技術方面的技能和專業知識。

使用手冊上次更新日期:2026 年 1 月 2 日

實驗室上次測試日期:2026 年 1 月 2 日

Copyright 2026 Google LLC 保留所有權利。Google 和 Google 標誌是 Google LLC 的商標,其他公司和產品名稱則有可能是其關聯公司的商標。

Before you begin

  1. Labs create a Google Cloud project and resources for a fixed time
  2. Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
  3. On the top left of your screen, click Start lab to begin

Use private browsing

  1. Copy the provided Username and Password for the lab
  2. Click Open console in private mode

Sign in to the Console

  1. Sign in using your lab credentials. Using other credentials might cause errors or incur charges.
  2. Accept the terms, and skip the recovery resource page
  3. Don't click End lab unless you've finished the lab or want to restart it, as it will clear your work and remove the project

This content is not currently available

We will notify you via email when it becomes available

Great!

We will contact you via email if it becomes available

One lab at a time

Confirm to end all existing labs and start this one

Use private browsing to run the lab

Using an Incognito or private browser window is the best way to run this lab. This prevents any conflicts between your personal account and the Student account, which may cause extra charges incurred to your personal account.

Complete this quick step to start your lab.