教學課程:在 Azure 中監視和更新 Linux 虛擬機器Tutorial: Monitor and update a Linux virtual machine in Azure

為了確保您的虛擬機器 (VM) 在 Azure 中正確執行,您可以檢閱開機診斷、效能計量及管理套件更新。To ensure your virtual machines (VMs) in Azure are running correctly, you can review boot diagnostics, performance metrics and manage package updates. 在本教學課程中,您了解如何:In this tutorial, you learn how to:

  • 啟用 VM 上的開機診斷Enable boot diagnostics on the VM
  • 檢視開機診斷View boot diagnostics
  • 檢視主機計量View host metrics
  • 啟用 VM 上的診斷擴充功能Enable diagnostics extension on the VM
  • 檢視 VM 計量View VM metrics
  • 依據診斷計量建立警示Create alerts based on diagnostic metrics
  • 管理套件更新Manage package updates
  • 監視變更和清查Monitor changes and inventory
  • 設定進階監視Set up advanced monitoring

開啟 Azure Cloud ShellOpen Azure Cloud Shell

Azure Cloud Shell 是裝載於 Azure 中的互動式殼層環境,並且會透過瀏覽器來使用。Azure Cloud Shell is an interactive shell environment hosted in Azure and used through your browse. Azure Cloud Shell 可讓您使用 bashPowerShell 殼層來執行各種可與 Azure 服務搭配運作的工具。Azure Cloud Shell allows you to use either bash or PowerShell shells to run a variety of tools to work with Azure services. Azure Cloud Shell 已預先安裝一些命令,可讓您執行本文的內容,而不必在本機環境上安裝任何工具。Azure Cloud Shell comes pre-installed with the commands to allow you to run the content of this article without having to install anything on your local environment.

若要在 Azure Cloud Shell 上執行本文所包含的任何程式碼,請開啟 Cloud Shell 工作階段、使用某個程式碼區塊上的 [複製] 按鈕來複製程式碼,然後使用 Ctrl+Shift+V (在 Windows 和 Linux 上) 或 Cmd+Shift+V (在 macOS 上) 將程式碼貼到 Cloud Shell 工作階段中。To run any code contained in this article on Azure Cloud Shell, open a Cloud Shell session, use the Copy button on a code block to copy the code, and paste it into the Cloud Shell session with Ctrl+Shift+V on Windows and Linux, or Cmd+Shift+V on macOS. 貼上的文字不會自動執行,因此請按 Enter 來執行程式碼。Pasted text is not automatically executed, so press Enter to run code.

您可以使用下列方式來啟動 Azure Cloud Shell:You can launch Azure Cloud Shell with:

選取程式碼區塊右上角的 [試試看] 。Select Try It in the upper-right corner of a code block. 這__不會__自動將文字複製到 Cloud Shell。This doesn't automatically copy text to Cloud Shell. Azure Cloud Shell 的試試看範例
在瀏覽器中開啟 shell.azure.comOpen shell.azure.com in your browser. 啟動 Azure Cloud Shell 按鈕Launch Azure Cloud Shell button
選取 Azure 入口網站右上角功能表上的 [Cloud Shell] 按鈕。Select the Cloud Shell button on the menu in the upper-right corner of the Azure portal. Azure 入口網站中的 [Cloud Shell] 按鈕

如果您選擇在本機安裝和使用 CLI,本教學課程會要求您執行 Azure CLI 2.0.30 版或更新版本。If you choose to install and use the CLI locally, this tutorial requires that you are running the Azure CLI version 2.0.30 or later. 執行 az --version 以尋找版本。Run az --version to find the version. 如果您需要安裝或升級,請參閱安裝 Azure CLIIf you need to install or upgrade, see Install Azure CLI.

建立 VMCreate VM

若要查看作用中的診斷和計量,您需要 VM。To see diagnostics and metrics in action, you need a VM. 首先,使用 az group create 建立資源群組。First, create a resource group with az group create. 下列範例會在 eastus 位置建立名為 myResourceGroupMonitor 的資源群組。The following example creates a resource group named myResourceGroupMonitor in the eastus location.

az group create --name myResourceGroupMonitor --location eastus

現在,使用 az vm create 建立 VM。Now create a VM with az vm create. 下列範例會建立名為 myVM 的 VM,並產生 SSH 金鑰 (如果 ~/.ssh/ 中沒有這些金鑰的話)︰The following example creates a VM named myVM and generates SSH keys if they do not already exist in ~/.ssh/:

az vm create \
  --resource-group myResourceGroupMonitor \
  --name myVM \
  --image UbuntuLTS \
  --admin-username azureuser \
  --generate-ssh-keys

啟用開機診斷Enable boot diagnostics

當 Linux VM 開機,開機診斷擴充功能會擷取開機輸出,並儲存在 Azure 儲存體。As Linux VMs boot, the boot diagnostic extension captures boot output and stores it in Azure storage. 這項資料可以用於 VM 開機問題的疑難排解。This data can be used to troubleshoot VM boot issues. 當您使用 Azure CLI 建立 Linux VM 時,開機診斷不會自動啟用。Boot diagnostics are not automatically enabled when you create a Linux VM using the Azure CLI.

啟用開機診斷之前,需要建立儲存體帳戶用來儲存開機記錄。Before enabling boot diagnostics, a storage account needs to be created for storing boot logs. 儲存體帳戶必須具有全域唯一的名稱,介於 3 到 24 個字元的長度,而且只能包含數字和小寫字母。Storage accounts must have a globally unique name, be between 3 and 24 characters, and must contain only numbers and lowercase letters. 使用 az storage account create 建立儲存體帳戶。Create a storage account with the az storage account create command. 在此範例中,使用隨機字串來建立唯一的儲存體帳戶名稱。In this example, a random string is used to create a unique storage account name.

storageacct=mydiagdata$RANDOM

az storage account create \
  --resource-group myResourceGroupMonitor \
  --name $storageacct \
  --sku Standard_LRS \
  --location eastus

當啟用開機診斷時,需要 blob 儲存體容器的 URI。When enabling boot diagnostics, the URI to the blob storage container is needed. 以下命令會查詢儲存體帳戶傳回此 URI。The following command queries the storage account to return this URI. URI 值儲存在名為 bloburi 的變數,下一個步驟會使用此變數。The URI value is stored in a variable names bloburi, which is used in the next step.

bloburi=$(az storage account show --resource-group myResourceGroupMonitor --name $storageacct --query 'primaryEndpoints.blob' -o tsv)

現在,使用 az vm boot-diagnostics enable 啟用開機診斷。Now enable boot diagnostics with az vm boot-diagnostics enable. --storage 值是在上一個步驟收集到的 blob URI。The --storage value is the blob URI collected in the previous step.

az vm boot-diagnostics enable \
  --resource-group myResourceGroupMonitor \
  --name myVM \
  --storage $bloburi

檢視開機診斷View boot diagnostics

開機診斷啟用後,每次您停止並啟動 VM 時,開機程序的相關資訊便會寫入記錄檔。When boot diagnostics are enabled, each time you stop and start the VM, information about the boot process is written to a log file. 在此範例中,先使用 az vm deallocate 命令將 VM 解除配置,如下所示:For this example, first deallocate the VM with the az vm deallocate command as follows:

az vm deallocate --resource-group myResourceGroupMonitor --name myVM

現在,使用 az vm start 命令啟動 VM,如下所示:Now start the VM with the az vm start command as follows:

az vm start --resource-group myResourceGroupMonitor --name myVM

您可以使用 az vm boot-diagnostics get-boot-log 命令取得 myVM 的開機診斷資料,如下所示︰You can get the boot diagnostic data for myVM with the az vm boot-diagnostics get-boot-log command as follows:

az vm boot-diagnostics get-boot-log --resource-group myResourceGroupMonitor --name myVM

檢視主機計量View host metrics

在 Azure 中有 Linux VM 專用的主機與它互動。A Linux VM has a dedicated host in Azure that it interacts with. 系統會自動收集主機的計量,而且可以在 Azure 入口網站中檢視這些計量,如下所示︰Metrics are automatically collected for the host and can be viewed in the Azure portal as follows:

  1. 從 Azure 入口網站中,選取 [資源群組],選擇 [myResourceGroupMonitor],然後選取資源清單中的 [myVM]。In the Azure portal, select Resource Groups, choose myResourceGroupMonitor, and then select myVM in the resource list.

  2. 若要查看主機 VM 的執行狀況,選取 VM 視窗上的 [計量],然後選擇 [可用的計量] 下的任何 [主機] 計量。To see how the host VM is performing, select Metrics on the VM window, then choose any of the [Host] metrics under Available metrics.

    檢視主機計量

安裝診斷擴充功能Install diagnostics extension

系統提供基本的主機計量,但若要查看更細微或 VM 特定的計量,則需要在 VM 上安裝 Azure 診斷延伸模組。The basic host metrics are available, but to see more granular and VM-specific metrics, you need to install the Azure diagnostics extension on the VM. Azure 診斷擴充功能可額外提供從 VM 擷取的監視和診斷資料。The Azure diagnostics extension allows additional monitoring and diagnostics data to be retrieved from the VM. 您可以檢視這些效能計量,並依據 VM 的執行狀況建立警示。You can view these performance metrics and create alerts based on how the VM performs. 診斷擴充功能可透過 Azure 入口網站安裝,如下所示︰The diagnostic extension is installed through the Azure portal as follows:

  1. 從 Azure 入口網站中,選擇 [資源群組],選取 [myResourceGroupMonitor],然後選取資源清單中的 [myVM]。In the Azure portal, choose Resource Groups, select myResourceGroupMonitor, and then select myVM in the resource list.

  2. 選取 [診斷設定]。Select Diagnosis settings. 在 [選擇儲存體帳戶] 下拉式選單中選擇前一節中所建立的 mydiagdata [1234] 帳戶 (如果尚未選取的話)。In the Pick a storage account drop-down menu, if not already selected, choose the mydiagdata[1234] account created in the previous section.

  3. 選取 [啟用來賓層級監視] 按鈕。Select the Enable guest-level monitoring button.

    檢視診斷計量

檢視 VM 計量View VM metrics

您可以檢視 VM 計量,和您檢視主機 VM 計量資訊的方式相同︰You can view the VM metrics in the same way that you viewed the host VM metrics:

  1. 從 Azure 入口網站中,選擇 [資源群組],選取 [myResourceGroupMonitor],然後選取資源清單中的 [myVM]。In the Azure portal, choose Resource Groups, select myResourceGroupMonitor, and then select myVM in the resource list.

  2. 若要查看 VM 的執行狀況,選取 VM 視窗上的 [計量],然後選取 [可用的計量] 下的任何 [來賓] 診斷計量。To see how the VM is performing, select Metrics on the VM window, and then select any of the [Guest] diagnostics metrics under Available metrics.

    檢視 VM 計量

建立警示Create alerts

您可以根據特定效能計量來建立警示。You can create alerts based on specific performance metrics. 舉例來說,可使用警示來通知您平均 CPU 使用量超過特定臨界值、或是可用磁碟空間降到低於某個量。Alerts can be used to notify you when average CPU usage exceeds a certain threshold or available free disk space drops below a certain amount, for example. 警示會顯示在 Azure 入口網站,或是可以透過電子郵件傳送。Alerts are displayed in the Azure portal or can be sent via email. 您也可以觸發 Azure 自動化 Runbook 或 Azure Logic Apps 以回應產生的警示。You can also trigger Azure Automation runbooks or Azure Logic Apps in response to alerts being generated.

以下範例會建立平均 CPU 使用量的警示。The following example creates an alert for average CPU usage.

  1. 從 Azure 入口網站中,選取 [資源群組],選取 [myResourceGroupMonitor],然後選取資源清單中的 [myVM]。In the Azure portal, select Resource Groups, select myResourceGroupMonitor, and then select myVM in the resource list.
  2. 選取 [警示 (傳統)],然後從警示視窗的頂端選擇 [新增計量警示 (傳統)]。Select Alerts (classic), then choose to Add metric alert (classic) across the top of the alerts window.
  3. 提供警示的 [名稱],例如 myAlertRule。Provide a Name for your alert, such as myAlertRule
  4. 若要在 CPU 百分比連續五分鐘超過 1.0 時觸發警示,保留所有其他已選取的預設值。To trigger an alert when CPU percentage exceeds 1.0 for five minutes, leave all the other defaults selected.
  5. (選擇性) 選取 [電子郵件的擁有者、參與者及讀者] 核取方塊以傳送電子郵件通知。Optionally, check the box for Email owners, contributors, and readers to send email notification. 預設動作是在入口網站中顯示通知。The default action is to present a notification in the portal.
  6. 選取 [確定] 按鈕。Select the OK button.

管理軟體更新Manage software updates

更新管理可讓您管理 Azure Linux VM 的更新和修補程式。Update management allows you to manage updates and patches for your Azure Linux VMs. 您可以直接從 VM 快速評估可用更新的狀態、排定何時安裝必要的更新,並檢閱部署結果來確認更新已成功套用至 VM。Directly from your VM, you can quickly assess the status of available updates, schedule installation of required updates, and review deployment results to verify updates were applied successfully to the VM.

如需價格資訊,請參閱更新管理的自動化價格For pricing information, see Automation pricing for Update management

啟用更新管理Enable Update management

啟用 VM 的更新管理:Enable Update management for your VM:

  1. 在畫面左邊,選取 [虛擬機器]。On the left-hand side of the screen, select Virtual machines.
  2. 從清單中選取 VM。From the list, select a VM.
  3. 在 [VM] 畫面的 [作業] 區段中,選取 [更新管理]。On the VM screen, in the Operations section, select Update management. [啟用更新管理] 畫面隨即開啟。The Enable Update Management screen opens.

將會執行驗證來判斷此 VM 是否已啟用更新管理。Validation is performed to determine if Update management is enabled for this VM. 驗證包括檢查 Log Analytics 工作區及連結的自動化帳戶,以及解決方法是否在工作區中。The validation includes checks for a Log Analytics workspace and linked Automation account, and if the solution is in the workspace.

Log Analytics 工作區可用來收集功能和服務 (例如更新管理) 所產生的資料。A Log Analytics workspace is used to collect data that is generated by features and services such as Update management. 工作區提供單一位置來檢閱和分析來自多個來源的資料。The workspace provides a single location to review and analyze data from multiple sources. 若要在需要更新的 VM 上執行其他動作,Azure 自動化可讓您對 VM 執行 Runbook,例如下載和套用更新。To perform additional actions on VMs that require updates, Azure Automation allows you to run runbooks against VMs, such as download and apply updates.

驗證程序也會檢查 VM 是否以 Log Analytics 代理程式和自動化混合式 Runbook 背景工作角色佈建。The validation process also checks to see if the VM is provisioned with the Log Analytics agent and Automation hybrid runbook worker. 此代理程式用來與 VM 通訊,並取得更新狀態的相關資訊。This agent is used to communicate with the VM and obtain information about the update status.

選擇 Log Analytics 工作區與自動化帳戶,然後選取 [啟用] 來啟用解決方案。Choose the Log Analytics workspace and automation account and select Enable to enable the solution. 啟用解決方案最多需要 15 分鐘。The solution takes up to 15 minutes to enable.

如果在上線期間遺漏下列任何必要條件,就會自動新增:If any of the following prerequisites were found to be missing during onboarding, they're automatically added:

[更新管理] 畫面隨即開啟。The Update Management screen opens. 設定位置、Log Analytics 工作區以及要使用的自動化帳戶,然後選取 [啟用]。Configure the location, Log Analytics workspace and Automation account to use and select Enable. 如果欄位呈現灰色,就表示已啟用 VM 的另一個自動化解決方案,且必須使用相同的工作區和自動化帳戶。If the fields are grayed out, that means another automation solution is enabled for the VM and the same workspace and Automation account must be used.

啟用更新管理解決方案

啟用解決方案可能需要 15 分鐘。Enabling the solution can take up to 15 minutes. 在此期間,請勿關閉瀏覽器視窗。During this time, you shouldn't close the browser window. 啟用解決方案之後,有關在 VM 上遺漏更新的相關資訊會流向 Azure 監視器記錄。After the solution is enabled, information about missing updates on the VM flows to Azure Monitor logs. 可能需要 30 分鐘到 6 小時,資料才可供分析。It can take between 30 minutes and 6 hours for the data to be available for analysis.

檢視更新評量View update assessment

啟用 [更新管理] 之後,隨即會顯示 [更新管理] 畫面。After Update management is enabled, the Update management screen appears. 完成更新評估之後,您會在 [遺失更新] 索引標籤上看到遺失的更新清單。After the evaluation of updates is complete, you see a list of missing updates on the Missing updates tab.

檢視更新狀態

排定更新部署Schedule an update deployment

若要安裝更新,請將部署排定在發行排程和服務時段之後。To install updates, schedule a deployment that follows your release schedule and service window. 您可以選擇要在部署中包含的更新類型。You can choose which update types to include in the deployment. 例如,您可以包含重大更新或安全性更新,並排除更新彙總套件。For example, you can include critical or security updates and exclude update rollups.

選取 [更新管理] 畫面頂端的 [排程更新部署],以針對 VM 來排程新的更新部署。To schedule a new Update Deployment for the VM, select Schedule update deployment at the top of the Update management screen. 在 [新增更新部署] 畫面上,指定下列資訊:In the New update deployment screen, specify the following information:

  • 名稱 - 提供唯一名稱來識別更新部署。Name - Provide a unique name to identify the update deployment.

  • 更新分類 - 選取更新部署在部署中包含的軟體類型。Update classification - Select the types of software the update deployment included in the deployment. 分類類型包括:The classification types are:

    • 重大更新和安全性更新Critical and security updates
    • 其他更新Other updates
  • 要排除的更新 - 您可以提供在更新部署期間應略過的套件名稱清單。Updates to Exclude - You can provide a list of package names that should be skipped during the update deployment. 套件名稱可支援萬用字元 (例如,kernel**)。Package names support wildcards (such as, *kernel*).

    更新排程設定畫面

  • 排程設定 - 您可以接受預設的日期和時間 (目前時間之後的 30 分鐘),或指定不同的時間。Schedule settings - You can either accept the default date and time, which is 30 minutes after current time, or specify a different time. 您也可以指定部署是否為發生一次,或設定週期性排程。You can also specify whether the deployment occurs once or set up a recurring schedule. 若要設定週期性排程,請選取 [週期] 下的 [週期性] 選項。Select the Recurring option under Recurrence to set up a recurring schedule.

    更新排程設定畫面

  • 維護時間範圍 (分鐘) - 指定您要執行更新部署的時段。Maintenance window (minutes) - Specify the period of time you want the update deployment to occur within. 這有助於確保在您定義的服務時段內執行變更。This helps ensure changes are performed within your defined service windows.

排程設定完成之後,請選取 [建立] 按鈕,您就會返回狀態儀表板。After you have completed configuring the schedule, select Create button and you return to the status dashboard. 請注意,[已排程] 表格會顯示您已建立的部署排程。Notice that the Scheduled table shows the deployment schedule you created.

警告

如果更新需要重新開機,VM 會自動重新啟動。For updates that require a reboot, the VM is restarted automatically.

檢視更新部署的結果View results of an update deployment

已排程的部署開始之後,您就可以在 [更新管理] 畫面的 [更新部署] 索引標籤上看到該部署的狀態。After the scheduled deployment starts, you can see the status for that deployment on the Update deployments tab on the Update management screen. 如果該部署目前正在執行,其狀態會顯示為 [進行中]。If it is currently running, it's status shows as In progress. 當它完成時,如果成功,狀態就會變更為 [成功]。After it completes, if successful, it changes to Succeeded. 如果該部署中的一或多個更新失敗,則狀態會是 [部分失敗]。If there is a failure with one or more updates in the deployment, the status is Partially failed. 選取已完成的更新部署,即可查看該更新部署的儀表板。Select the completed update deployment to see the dashboard for that update deployment.

特定部署的更新部署狀態儀表板

[更新結果] 磚包含 VM 上的更新總數和部署結果的摘要。In Update results tile is a summary of the total number of updates and deployment results on the VM. 右邊表格是每個更新和安裝結果的詳細解析,可能是下列其中一個值:In the table to the right is a detailed breakdown of each update and the installation results, which could be one of the following values:

  • 未嘗試 - 未安裝更新,因為在已定義的維護時段內,沒有足夠的時間可用。Not attempted - the update was not installed because there was insufficient time available based on the maintenance window duration defined.
  • 成功 - 更新已順利完成Succeeded - the update succeeded
  • 失敗 - 更新失敗Failed - the update failed

若要查看部署已建立的所有記錄項目,請選取 [所有記錄]。Select All logs to see all log entries that the deployment created.

選取 [輸出] 磚,以查看負責在目標 VM 上管理更新部署的 Runbook 作業串流。Select the Output tile to see job stream of the runbook responsible for managing the update deployment on the target VM.

若要查看部署所傳回的任何錯誤詳細資訊,請選取 [錯誤]。Select Errors to see detailed information about any errors from the deployment.

監視變更和清查Monitor changes and inventory

您可以在電腦上收集並檢視軟體、檔案、Linux 精靈、Windows 服務和 Windows 登錄機碼的清查。You can collect and view inventory for software, files, Linux daemons, Windows Services, and Windows registry keys on your computers. 追蹤您電腦的設定可協助您找出環境中的操作問題,並進一步了解您電腦的狀態。Tracking the configurations of your machines can help you pinpoint operational issues across your environment and better understand the state of your machines.

啟用變更和清查管理Enable Change and Inventory management

為您的 VM 啟用「變更」和「清查」管理:Enable Change and Inventory management for your VM:

  1. 在畫面左邊,選取 [虛擬機器]。On the left-hand side of the screen, select Virtual machines.
  2. 從清單中選取 VM。From the list, select a VM.
  3. 在 VM 畫面上,選取 [作業] 區段中的 [清查] 或 [變更追蹤]。On the VM screen, in the Operations section, select Inventory or Change tracking. [啟用變更追蹤與詳細目錄] 畫面隨即開啟。The Enable Change Tracking and Inventory screen opens.

設定位置、Log Analytics 工作區以及要使用的自動化帳戶,然後選取 [啟用]。Configure the location, Log Analytics workspace and Automation account to use and select Enable. 如果欄位呈現灰色,就表示已啟用 VM 的另一個自動化解決方案,且必須使用相同的工作區和自動化帳戶。If the fields are grayed out, that means another automation solution is enabled for the VM and the same workspace and Automation account must be used. 儘管這些解決方案在功能表上是分開的,但它們是相同的解決方案。Even though the solutions are separate on the menu, they are the same solution. 啟用其中一個會為您的 VM 同時啟用兩個。Enabling one enables both for your VM.

啟用變更與清查追蹤

啟用解決方案之後,可能需要一些時間在 VM 上收集清查,然後才會顯示資料。After the solution has been enabled, it may take some time while inventory is being collected on the VM before data appears.

追蹤變更Track changes

在您的 VM 上,選取 [作業] 底下的 [變更追蹤]。On your VM, select Change Tracking under OPERATIONS. 選取 [編輯設定],就會顯示 [變更追蹤] 頁面。Select Edit Settings, the Change Tracking page is displayed. 選取您想要追蹤的設定類型,然後選取 [+ 新增] 來進行設定。Select the type of setting you want to track and then select + Add to configure the settings. 可用的 Linux 選項為 [Linux 檔案]The available option Linux is Linux Files

如需有關「變更追蹤」的詳細資訊,請參閱 針對 VM 上的變更進行疑難排解For detailed information on Change Tracking see, Troubleshoot changes on a VM

檢視清查View inventory

在您的 VM 上,選取 [作業] 底下的 [清查]。On your VM, select Inventory under OPERATIONS. 在 [軟體] 索引標籤上,有一份資料表列出已找到的軟體。On the Software tab, there is a table list the software that had been found. 每一筆軟體記錄的高階詳細資料都可在資料表中進行檢視。The high-level details for each software record are viewable in the table. 這些詳細資料包括軟體名稱、版本、發行者、上次重新整理時間。These details include the software name, version, publisher, last refreshed time.

檢視清查

監視活動記錄和變更Monitor Activity logs and changes

從您 VM 上的 [變更追蹤] 頁面,選取 [管理活動記錄連線]。From the Change tracking page on your VM, select Manage Activity Log Connection. 此工作會開啟 [Azure 活動記錄] 頁面。This task opens the Azure Activity log page. 選取 [連線] 可將變更追蹤連線 VM 的 Azure 活動記錄。Select Connect to connect Change tracking to the Azure activity log for your VM.

此設定啟用時,瀏覽至您 VM 的 [概觀] 頁面,並選取 [停止] 來將您的 VM 停止。With this setting enabled, navigate to the Overview page for your VM and select Stop to stop your VM. 出現提示時,選取 [是] 可停止 VM。When prompted, select Yes to stop the VM. 當它解除配置時,選取 [啟動] 可將您的 VM 重新啟動。When it is deallocated, select Start to restart your VM.

將 VM 記錄停止和啟動,可在其活動記錄中記錄事件。Stopping and starting a VM logs an event in its activity log. 瀏覽回 [變更追蹤] 頁面。Navigate back to the Change tracking page. 選取頁面底部的 [事件] 索引標籤。Select the Events tab at the bottom of the page. 一段時間之後,就會在圖表和資料表中顯示事件。After a while, the events shown in the chart and the table. 您可以選取每一個事件來檢視該事件的相關詳細資訊。Each event can be selected to view detailed information on the event.

檢視活動記錄中的變更

圖表會顯示一段時間內已發生的變更。The chart shows changes that have occurred over time. 在您新增活動記錄連線之後,頂端的線條圖表會顯示 Azure 活動記錄事件。After you have added an Activity Log connection, the line graph at the top displays Azure Activity Log events. 長條圖中的每個資料列都代表不同的可追蹤變更類型。Each row of bar graphs represents a different trackable Change type. 這些類型是 Linux 精靈、檔案和軟體。These types are Linux daemons, files, and software. [變更] 索引標籤會以發生變更時間的遞減順序 (最新的優先),顯示視覺效果中所顯示變更的詳細資料。The change tab shows the details for the changes shown in the visualization in descending order of time that the change occurred (most recent first).

進階監視Advanced monitoring

您可使用適用於 VM 的 Azure 監視器進行更進階的 VM 監視,該監視器可藉由分析 Windows 和 Linux VM 的效能和健康情況 (包括其不同的程序以及其他資源和外部程序的互連相依性),大規模監視 Azure 虛擬機器 (VM)。You can do more advanced monitoring of your VM by using a solution like Azure Monitor for VMs, which monitors your Azure virtual machines (VM) at scale by analyzing the performance and health of your Windows and Linux VMs, including their different processes and interconnected dependencies on other resources and external processes. Azure VM 的組態管理示透過 Azure 自動化變更追蹤和清查解決方案提供,可輕鬆地識別您環境中的變更。Configuration management of your Azure VMs is delivered with the Azure Automation Change Tracking and Inventory solution to easily identify changes in your environment. 管理更新合規性是透過 Azure 自動化更新管理解決方案提供。Managing update compliance is provided with the Azure Automation Update Management solution.

從 VM 連線至的 Log Analytics 工作區,您也可以利用豐富2查詢語言來擷取、彙總及分析所收集的資料。From the Log Analytics workspace the VM is connected to, you can also retrieve, consolidate, and analyze collected data with the rich query language.

Log Analytics 工作區

後續步驟Next steps

在本教學課程中,您已設定、檢閱和管理 VM 的更新。In this tutorial, you configured, reviewed, and managed updates for a VM. 您已了解如何︰You learned how to:

  • 啟用 VM 上的開機診斷Enable boot diagnostics on the VM
  • 檢視開機診斷View boot diagnostics
  • 檢視主機計量View host metrics
  • 啟用 VM 上的診斷擴充功能Enable diagnostics extension on the VM
  • 檢視 VM 計量View VM metrics
  • 依據診斷計量建立警示Create alerts based on diagnostic metrics
  • 管理套件更新Manage package updates
  • 監視變更和清查Monitor changes and inventory
  • 設定進階監視Set up advanced monitoring

請前進到下一個教學課程,以了解 Azure 資訊安全中心。Advance to the next tutorial to learn about Azure Security Center.