查看作業套件代理程式疑難排解資訊

本文說明診斷資訊的來源,您可以使用這些資訊,找出 Ops Agent 安裝或執行時的問題。

使用 gcpdiag 驗證代理程式狀態

您可以使用 gcpdiag 回報個別 VM 或專案中整個 VM 機群的 Ops Agent 狀態,確認代理程式已安裝,且正在傳送記錄和指標。gcpdiag 可以建立多種格式的狀態報表,包括 CSV 或 JSON 格式。

以下是 CSV 格式的機群代理程式狀態報表:

🔎 gce/ERR/2024_004: Verify Ops Agent is installed on GCE VMs and is sending logs and metrics.

gce/ERR/2024_004,projects/my-project/zones/my-location/instances/instance-1,failed,Ops Agent not installed on the VM,https://gcpdiag.dev/rules/gce/ERR/2024_004
gce/ERR/2024_004,projects/my-project/zones/my-location/instances/instance-2,skipped,VM Manager is needed for the ops agent detection. Please enable it at: https://cloud.google.com/compute/docs/manage-os#automatic and run this check again.,https://gcpdiag.dev/rules/gce/ERR/2024_004
gce/ERR/2024_004,projects/my-project/zones/my-location/instances/instance-3,skipped,VM Manager is needed for the ops agent detection. Please enable it at: https://cloud.google.com/compute/docs/manage-os#automatic and run this check again.,https://gcpdiag.dev/rules/gce/ERR/2024_004
gce/ERR/2024_004,projects/my-project/zones/my-location/instances/instance-4,ok,"Ops Agent installed on the VM, and is successfully sending logs and metrics.",https://gcpdiag.dev/rules/gce/ERR/2024_004
gce/ERR/2024_004,projects/my-project/zones/my-location/instances/instance-5,ok,"Ops Agent installed on the VM, and is successfully sending logs and metrics.",https://gcpdiag.dev/rules/gce/ERR/2024_004

gcpdiag 工具是由 Google Cloud 支援團隊建立,可協助您自行診斷 Google Cloud 專案中的常見問題,包括 Ops Agent 的問題。gcpdiag 是開放原始碼工具,並非官方 Google Cloud產品,但 Google Cloud 支援團隊會積極開發及維護。歡迎在 GitHub 上貢獻內容或回報問題。

事前準備

gcpdiag 已與 Cloud Shell 整合,因此您不必安裝任何項目即可執行。如要執行 gcpdiag,必須先符合下列必要條件:

  • 授權:gcpdiag 會使用 Cloud Shell 中的應用程式預設憑證 (ADC) 進行驗證。
    請確認與 gcpdiag 搭配使用的憑證,在執行 Ops Agent 的 Google Cloud 專案中至少具備下列角色:

    • 檢視者 (roles/viewer)
    • 服務使用情形消費者 (roles/serviceusage.serviceUsageConsumer)
  • API:如要在專案中使用 gcpdiag,必須啟用下列 API:

    • Cloud Resource Manager API:cloudresourcemanager.googleapis.com
    • Identity and Access Management API:iam.googleapis.com
    • Cloud Logging API:logging.googleapis.com
    • Service Usage:serviceusage.googleapis.com

    如要啟用這些 API,請在 Cloud Shell 或其他指令列中執行下列指令:

     gcloud --project=PROJECT_ID services enable \
       cloudresourcemanager.googleapis.com \
       iam.googleapis.com \
       logging.googleapis.com \
       serviceusage.googleapis.com
    
  • VM 管理員:在執行個體上啟用免費方案的 VM 管理員。如果您在建立 VM 時安裝 Ops Agent,或由代理程式政策管理 VM 執行個體上的 Ops Agent 安裝作業,則已符合 VM 管理員 的要求。

執行 gcpdiag

與 Ops Agent 搭配使用的 gcpdiag 指令,基本語法如下:

gcpdiag lint --project=PROJECT_ID [--name=INSTANCE_NAME] --show-skipped --include=gce/err/2024_004 [--output=[CSV|JSON]]
  • PROJECT_ID 是 Google Cloud 專案的 ID。
  • INSTANCE_NAME 是 Compute Engine VM 的名稱。使用 --name 選項查詢特定 VM;省略該選項則會查詢整個機群。
  • 使用 --output 選項,將報表儲存為 CSV 或 JSON 格式的檔案;如果不需要輸出檔案,請省略這個選項。

--include 選項的值會指定一或多個 gcpdiag 規則;gce/ERR/2024-004 是 Ops Agent 的規則。如要進一步瞭解 gcpdiag 指令的語法,請參閱「gcpdiag - Google Cloud Platform 診斷」。

舉例來說,如要為「my-project」專案產生全機群報表,請執行下列指令:

gcpdiag lint --project=my-project --show-skipped --include=gce/ERR/2024_004

輸出結果會與下列內容相似:

🔎 gce/ERR/2024_004: Verify Ops Agent is installed on GCE VMs and is sending logs and metrics.
  - my-project/instance-1                                                 [FAIL] Ops Agent not installed on the VM
  - my-project/instance-2                                                 [FAIL] Ops Agent not installed on the VM
  - my-project/instance-3                                                 [SKIP] Unable to confirm Ops Agent installation
  VM Manager is needed for the ops agent detection. Please enable it at: https://cloud.google.com/compute/docs/manage-os#automatic and run this check again.
  - my-project/instance-4                                            [FAIL] Ops Agent is installed, but it's failing to send both logs and metrics to Google Cloud.
  Is Ops Agent sending logs? (Yes)  Is Ops Agent sending metrics? (No)
  - my-project/instance-5                                                 [FAIL] Ops Agent is installed, but it's failing to send both logs and metrics to Google Cloud.
  Is Ops Agent sending logs? (No)   Is Ops Agent sending metrics? (No)
  - my-project/instance-6                                                 [ OK ] Ops Agent installed on the VM, and is successfully sending logs and metrics.
  - my-project/instance-7                                                 [ OK ] Ops Agent installed on the VM, and is successfully sending logs and metrics.

如要為專案「my-project」中的執行個體「my-instance」產生報表,請執行下列指令:

gcpdiag lint  --project=my-project --name=my-instance --show-skipped --include=gce/err/2024_004

輸出結果會與下列內容相似:

🔎 gce/ERR/2024_004: Verify Ops Agent is installed on GCE VMs and is sending logs and metrics.
  - my-project/my-instance   [ OK ] Ops Agent installed on the VM, and is successfully sending logs and metrics.

如果 gcpdiag 指令失敗,且輸出內容與下方類似,請確認您已符合執行工具的所有必要條件。

WARNING:googleapiclient.http:Encountered 403 Forbidden with reason "PERMISSION_DENIED"
[ERROR]:can't access project my-project: Cloud Resource Manager API has not been used in project my-project before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudresourcemanager.googleapis.com/overview?project=my-project then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry..
[DEBUG]: An Http Error occurred whiles accessing projects.get

HttpError 403 when requesting https://cloudresourcemanager.googleapis.com/v3/projects/my-project?alt=json returned Cloud Resource Manager API has not been used in project my-project before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudresourcemanager.googleapis.com/overview?project=my-project then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry. Details: ...
[ERROR]:exiting program...
error getting project details

解讀 gcpdiag 輸出內容

本節提供相關資訊,協助您瞭解及使用 gcpdiag 產生的報告。

gcpdiag 指令會產生包含下列資訊的報告:

  • 叫用指令的 gcpdiag 規則指標。 Ops Agent 的資訊如下所示:
    🔎 gce/ERR/2024_004: Verify Ops Agent is installed on GCE VMs and is sending logs and metrics
  • 特定 VM 的結果 ID,格式為 PROJECT_ID/INSTANCE_ID。如果是全機群報表,輸出內容會包含每個 VM 的項目。如果是單一 VM 報表,輸出內容會包含單一項目。
  • 檢查狀態。狀態會是下列其中一個值:
  • 狀態值的說明。

以下各節將進一步說明狀態值及其意義。

狀態:OK

如果狀態為 OK,表示 Ops Agent 正在 VM 上執行,並從 VM 傳送記錄和指標。報表包含下列狀態說明:
Ops Agent installed on the VM, and is successfully sending logs and metrics.

狀態:FAIL

如果狀態為 FAIL,表示未安裝 Ops Agent,或未從 VM 傳送記錄和指標。狀態說明會指出偵測到的問題:

  • 如果未安裝 Ops Agent,系統會顯示下列狀態說明:
    Ops Agent not installed on the VM
  • 如果 Ops Agent 未從 VM 傳送記錄和指標,您會看到類似下列的狀態說明:
    Agent is installed, but it's failing to send both logs and metrics to Google Cloud.
    Is Ops Agent sending logs? (Yes) Is Ops Agent sending metrics? (No)

如果尚未安裝 Ops Agent,請安裝 Ops Agent。如果安裝失敗,原因可能是以下其中一個:

  • VM 沒有相關聯的服務帳戶。如要解決這個問題,請將服務帳戶附加至 VM,然後再次嘗試安裝 Ops Agent。
  • VM 已安裝其中一個舊版代理程式 (Monitoring 代理程式或 Logging 代理程式)。如要解決這個問題,請解除安裝舊版代理程式,然後再次嘗試安裝 Ops Agent。

如果 Ops Agent 未從 VM 傳送記錄或指標,請使用代理程式健康狀態檢查,找出開始時間錯誤並修正問題。

狀態:SKIP

如果狀態為 SKIP,表示 gcpdiag 無法判斷 VM 是否已安裝 Ops Agent。報表包含下列狀態說明:
Unable to confirm Ops Agent installation
  VM Manager is needed for the ops agent detection.
  Please enable it at: https://cloud.google.com/compute/docs/manage-os#automatic and run this check again.

如要測試代理程式的狀態,gcpdiag 需要在 VM 上執行 VM 管理員。如要解決這個問題,請在執行個體上安裝 VM 管理員免費方案。安裝後,請等待 15 分鐘,然後再次嘗試執行 gcpdiag 指令。

代理健康狀態檢查

2.25.1 版推出了 Ops Agent 的啟動時間健康狀態檢查。Ops Agent 啟動時,會執行一系列檢查,確認是否有任何條件會導致代理程式無法正常運作。如果代理程式偵測到其中一項狀況,就會記錄說明問題的訊息。Ops Agent 會檢查下列項目:

  • 連線問題
  • 代理程式用於回報自身指標的通訊埠可用性
  • 權限問題
  • 代理程式用來寫入記錄或指標的 API 可用性
  • 健康狀態檢查常式本身有問題。
如要瞭解如何找出開始時間錯誤,請參閱「找出開始時間錯誤」。

2.37.0 版推出了 Ops Agent 的執行階段健康狀態檢查。這些錯誤會回報給 Cloud Logging 和 Error Reporting。如要瞭解如何找出執行階段錯誤,請參閱「找出執行階段錯誤」。

2.46.0 版推出了資訊 LogPingOpsAgent 代碼。這個代碼不代表發生錯誤。詳情請參閱「確認記錄收集成功」。

下表依字母順序列出各個健康狀態檢查代碼,並說明每個代碼的意義。以字串 Err 結尾的代碼表示錯誤,其他代碼則為資訊。

健康狀態檢查代碼 類別 意義 建議
DLApiConnErr 連線能力 無法向下載子網域 dl.google.com 提出要求。 請檢查網際網路連線和防火牆規則。 詳情請參閱「網路連線問題」。
FbMetricsPortErr 通訊埠可用性 無法使用 Ops Agent 自行指標所需的通訊埠 20202。 確認通訊埠 20202 已開啟。詳情請參閱「無法使用必要通訊埠」。
HcFailureErr Generic Ops Agent 健康狀態檢查常式發生內部錯誤。 透過 Google Cloud 控制台提交客服案件。 詳情請參閱「取得支援」。
LogApiConnErr 連線能力 Logging API 要求失敗。 請檢查網際網路連線和防火牆規則。 詳情請參閱「網路連線問題」。
LogApiDisabledErr API 目前的 Google Cloud 專案已停用 Logging API。 啟用 Logging API。
LogApiPermissionErr 權限 服務帳戶缺少記錄檔寫入者角色 (roles/logging.logWriter)。 將記錄檔寫入者角色授予服務帳戶。詳情請參閱「代理程式缺少 API 權限」。
LogApiScopeErr 權限 VM 缺少 https://www.googleapis.com/​auth/​logging.write 存取權範圍。 將 https://www.googleapis.com/​auth/​logging.write 範圍新增至 VM。詳情請參閱「驗證存取權範圍」。
LogApiUnauthenticatedErr API 目前的 VM 無法向 Logging API 進行驗證。 請確認憑證檔案、VM 存取權範圍和權限設定正確無誤。詳情請參閱「授權 Ops Agent」。
LogPingOpsAgent   每 10 分鐘寫入 ops-agent-health 記錄的資訊酬載訊息。您可以使用產生的記錄項目,確認代理程式是否正在傳送記錄。這則訊息並非錯誤。 這則訊息預計每 10 分鐘顯示一次。如果訊息在 20 分鐘後仍未顯示,表示代理程式可能發生問題。如需疑難排解資訊,請參閱「排解 Ops Agent 問題」。
LogParseErr 執行階段 Ops Agent 無法剖析一或多個記錄檔。 檢查您建立的任何記錄處理器設定。 詳情請參閱「記錄剖析錯誤」。
LogPipeLineErr 執行階段 Ops Agent 的記錄管道失敗。 確認代理程式可以存取緩衝區檔案、檢查磁碟是否已滿,以及確認 Ops Agent 設定正確無誤。詳情請參閱「管道錯誤」。
MetaApiConnErr 連線能力 無法向 GCE 中繼資料伺服器傳送要求,查詢 VM 存取權範圍、OAuth 權杖和資源標籤。 請檢查網際網路連線和防火牆規則。 詳情請參閱「網路連線問題」。
MonApiConnErr 連線能力 Monitoring API 要求失敗。 請檢查網際網路連線和防火牆規則。 詳情請參閱「網路連線問題」。
MonApiDisabledErr API 目前的 Google Cloud 專案已停用 Monitoring API。 啟用 Monitoring API。
MonApiPermissionErr 權限 服務帳戶缺少 Monitoring 指標寫入者角色 (roles/monitoring.metricWriter)。 將 Monitoring 指標寫入者角色授予服務帳戶。詳情請參閱「代理程式缺少 API 權限」。
MonApiScopeErr 權限 VM 缺少 https://www.googleapis.com/​auth/​monitoring.write 存取權範圍。 將 https://www.googleapis.com/​auth/​monitoring.write 範圍新增至 VM。詳情請參閱「驗證存取權範圍」。
MonApiUnauthenticatedErr API 目前的 VM 無法向 Monitoring API 進行驗證。 請確認憑證檔案、VM 存取權範圍和權限設定正確無誤。詳情請參閱「授權 Ops Agent」。
OtelMetricsPortErr 通訊埠可用性 無法使用 Ops Agent 自我指標所需的通訊埠 20201。 確認通訊埠 20201 已開啟。 詳情請參閱「無法使用必要通訊埠」。
PacApiConnErr 連線能力 這個健康狀態檢查程式碼不可靠。這組程式碼在 Ops Agent 2.46.1 版中已停用。 更新至 Ops Agent 2.46.1 以上版本。

找出啟動時間錯誤

本機健康狀態檢查記錄檔的位置,會因代理程式的安裝方式而異:使用 VM 擴充功能管理工具擴充功能政策安裝,或使用其他方法安裝。

並非由 VM 擴充功能管理工具安裝

自 2.35.0 版起,健康狀態檢查資訊會由 Cloud Logging API 寫入 ops-agent-health 記錄 (2.33.0、2.34.0 版使用 ops-agent-health-checks)。相同資訊也會寫入 health-checks.log 檔案,如下所示:

  • Linux: /var/log/google-cloud-ops-agent/health-checks.log
  • Windows: C:\ProgramData\Google\Cloud Operations\Ops Agent\log\health-checks.log

您也可以查詢 Ops Agent 服務的狀態,查看任何健康狀態檢查訊息,如下所示:

  • 在 Linux 中,執行下列指令:
       sudo systemctl status google-cloud-ops-agent"*"
       

    尋找類似「[Ports Check] Result: PASS」的訊息。 其他結果包括「ERROR」和「FAIL」。

  • 在 Windows 上,請使用 Windows 事件檢視器。找出與 google-cloud-ops-agent 服務相關的「資訊」、「錯誤」或「失敗」訊息。

解決問題後,請務必重新啟動代理程式。代理程式啟動時會執行健康狀態檢查,因此如要重新執行檢查,必須重新啟動代理程式。

由 VM 擴充功能管理工具安裝

健康狀態檢查資訊會由 Cloud Logging API 寫入 ops-agent-health 記錄。如果 Ops Agent 是由 VM 擴充功能管理工具擴充功能政策管理,系統也會將相同資訊寫入 health-checks.log 檔案,如下所示:

  • Linux: /var/lib/google-guest-agent/INSTANCE_ID/agent_state/plugins/ops-agent/logs/google-cloud-ops-agent/health-checks.log
  • Windows: C:\ProgramData\Google\Compute Engine\google-guest-agent\INSTANCE_ID\agent_state\plugins\ops-agent\health-checks.log

解決問題後,請務必重新啟動代理程式。代理程式啟動時會執行健康狀態檢查,因此如要重新執行檢查,必須重新啟動代理程式。

找出執行階段錯誤

執行階段健康狀態檢查會回報給 Cloud Logging 和 Error Reporting。如果代理程式無法啟動,但在失敗前能回報錯誤,您可能也會看到回報的啟動時間錯誤。

如要在 Logging 中查看 Ops Agent 的執行階段錯誤,請按照下列步驟操作:

  1. 前往 Google Cloud 控制台的 「Logs Explorer」頁面:

    前往「Logs Explorer」(記錄檔探索工具)

    如果您是使用搜尋列尋找這個頁面,請選取子標題為「Logging」的結果。

  2. 輸入以下查詢並點選「執行查詢」:
    log_id("ops-agent-health")

如要在 Error Reporting 中查看 Ops Agent 的執行階段錯誤,請按照下列步驟操作:

  1. 前往 Google Cloud 控制台的「Error Reporting」頁面:

    前往「Error Reporting」

    您也可以透過搜尋列找到這個頁面。

  2. 如要查看 Ops Agent 的錯誤,請篩選 Ops Agent 的錯誤。

確認記錄收集成功

Ops Agent 2.46.0 版推出了資訊性 LogPingOpsAgent 健康狀態檢查。這項檢查每 10 分鐘會將資訊訊息寫入 ops-agent-health。您可以透過下列任一方式,使用這些訊息來確認 Ops Agent 是否正在寫入記錄:

如果上述任一選項指出系統未擷取記錄訊息,您可以採取下列做法:

如要查看特定 VM 的 Ops Agent 狀態,您需要該 VM 的執行個體 ID。如要找出執行個體 ID,請按照下列步驟操作:

  • 前往 Google Cloud 控制台的「VM instances」(VM 執行個體) 頁面:

    前往「VM instances」(VM 執行個體) 頁面

    如果您是使用搜尋列尋找這個頁面,請選取子標題為「Compute Engine」的結果。

  • 按一下 VM 執行個體的名稱。
  • 在「Details」(詳細資料) 分頁中,找到「Basic information」(基本資訊) 區段。 執行個體 ID 會顯示為數值字串。在後續章節中,請使用這個字串做為 INSTANCE_ID 值。

VM 代理程式診斷工具

代理程式診斷工具會從 VM 收集下列所有代理程式的重要本機偵錯資訊:Ops Agent、舊版 Logging 代理程式和舊版 Monitoring 代理程式。偵錯資訊包括專案資訊、VM 資訊、代理程式設定、代理記錄、代理程式服務狀態,以及通常需要手動收集的資訊。這項工具也會檢查本機 VM 環境,確保符合代理程式正常運作的特定需求,例如網路連線和必要權限。

為 VM 上的代理程式提交客戶案件時,請執行代理程式診斷工具,並將收集到的資訊附加至案件。提供這項資訊可縮短疑難排解客服案件所需的時間。將資訊附加至客服案件前,請先遮蓋密碼等私密資訊。

代理程式診斷工具必須在 VM 內執行,因此您通常需要先透過 SSH 連線至 VM。下列指令會擷取並執行代理程式診斷工具:

Linux

curl -sSO https://dl.google.com/cloudagents/diagnose-agents.sh
sudo bash diagnose-agents.sh

Windows

(New-Object Net.WebClient).DownloadFile("https://dl.google.com/cloudagents/diagnose-agents.ps1", "${env:UserProfile}\diagnose-agents.ps1")
Invoke-Expression "${env:UserProfile}\diagnose-agents.ps1"

請按照指令碼執行輸出內容,找出包含收集資訊的檔案。除非您在執行指令碼時自訂輸出目錄,否則通常可以在 Linux 的 /var/tmp/google-agents 目錄和 Windows 的 $env:LOCALAPPDATA/Temp 目錄中找到這些檔案。

如需詳細資訊,請查看 Linux 上的 diagnose-agents.sh 指令碼或 Windows 上的 diagnose-agents.ps1 指令碼。

自動安裝政策的代理程式診斷工具

如果嘗試使用 Ops Agent OS 政策安裝 Ops Agent 失敗,您可以使用本節所述的診斷指令碼進行偵錯。舉例來說,您可能會看到下列其中一種情況:

  • 如果您勾選「Install Ops Agent for Monitoring and Logging」(安裝 Ops Agent 以進行監控和記錄) 核取方塊,在建立 VM 時安裝 Ops Agent,Ops Agent 安裝作業會失敗。
  • Cloud Monitoring「VM instances」(VM 執行個體) 資訊主頁或 Compute Engine VM 詳細資料頁面的「Observability」(觀測能力) 分頁上的代理程式狀態維持在「Pending」(待處理) 狀態超過 10 分鐘。如果狀態長時間顯示為「待處理」,可能代表下列其中一種情況:

    • 套用政策時發生問題。
    • 實際安裝 Ops Agent 時發生問題。
    • VM 與 Cloud Monitoring 之間的連線問題。

    對於其中部分問題,一般代理程式診斷指令碼和健康狀態檢查也可能有所幫助。

如要執行政策診斷指令碼,請執行下列指令:

curl -sSO https://dl.google.com/cloudagents/diagnose-ui-policies.sh
bash diagnose-ui-policies.sh VM_NAME VM_ZONE

這個指令碼會顯示受影響 VM 和相關自動安裝政策的資訊。

為 VM 上的代理程式提交客戶案件時,請執行代理程式診斷工具,並將收集到的資訊附加至案件。提供這項資訊可縮短疑難排解客服案件所需的時間。將資訊附加至客服案件前,請先遮蓋密碼等私密資訊。

代理自我記錄

如果代理程式無法將記錄擷取至 Cloud Logging,您可能需要在 VM 本機檢查代理程式的記錄,以便進行疑難排解。您也可以使用記錄檔輪替來管理代理程式的自我記錄。

代理程式自我記錄檔的位置,取決於代理程式是使用 VM 擴充功能管理工具擴充功能政策安裝,還是透過其他方法安裝。請參閱下列各節:

並非由 VM 擴充功能管理工具安裝

Linux

如要檢查寫入 Journald 的自我記錄,請執行下列指令:

journalctl -u google-cloud-ops-agent*

如要檢查記錄模組寫入磁碟的自我記錄,請執行下列指令:

vim -M /var/log/google-cloud-ops-agent/subagents/logging-module.log

Windows

如要檢查寫入 Windows Event Logs 的自我記錄,請執行下列指令:

Get-WinEvent -FilterHashtable @{ Logname='Application'; ProviderName='google-cloud-ops-agent*' } | Format-Table -AutoSize -Wrap

如要檢查記錄模組寫入磁碟的自我記錄,請執行下列指令:

notepad "C:\ProgramData\Google\Cloud Operations\Ops Agent\log\logging-module.log"

如要檢查 Ops Agent 服務的 Windows Service Control Manager 記錄,請執行下列指令:

Get-WinEvent -FilterHashtable @{ Logname='System'; ProviderName='Service Control Manager' } | Where-Object -Property Message -Match 'Google Cloud Ops Agent' | Format-Table -AutoSize -Wrap

由 VM 擴充功能管理工具安裝

Linux

如要檢查記錄模組寫入磁碟的自我記錄,請執行下列指令:

vim -M /var/lib/google-guest-agent/INSTANCE_ID/agent_state/plugins/ops-agent/log/google-cloud-ops-agent/subagents/logging-module.log

Windows

如要檢查寫入 Windows Event Logs 的自我記錄,請執行下列指令:

Get-WinEvent -FilterHashtable @{ Logname='Application'; ProviderName='google-cloud-ops-agent*' } | Format-Table -AutoSize -Wrap

如要檢查記錄模組寫入磁碟的自我記錄,請執行下列指令:

notepad "C:\ProgramData\Google\Compute Engine\google-guest-agent\INSTANCE_ID\agent_state\plugins\ops-agent\logging-module.log"

在 Cloud Monitoring 查看指標使用狀況與診斷資訊

Cloud Monitoring 的「Metrics Management」(指標管理) 頁面提供相關資訊,可協助您控管可計費指標的支出,同時不影響觀測能力。「Metrics Management」(指標管理) 頁面會回報下列資訊:

  • 依位元組和樣本計費的擷取量,涵蓋指標網域和個別指標。
  • 指標標籤和基數的資料。
  • 每項指標的讀取次數。
  • 警告政策和自訂資訊主頁中的指標使用情形。
  • 指標寫入錯誤率。

您也可以使用「指標管理」頁面排除不必要的指標,避免產生擷取費用。

如要查看「Metrics Management」(指標管理) 頁面,請按照下列步驟操作:

  1. 前往 Google Cloud 控制台的「Metrics management」(指標管理) 頁面:

    前往「Metrics management」(指標管理)

    如果您是使用搜尋列尋找這個頁面,請選取子標題為「Monitoring」的結果。

  2. 在工具列中選取時間範圍。根據預設,「Metrics Management」(指標管理) 頁面會顯示過去一天收集的指標資訊。

如要進一步瞭解「Metrics Management」(指標管理) 頁面,請參閱「查看及管理指標用量」。