分享方式:


適用於 Linux 的 Azure 監視器相依性虛擬機器擴充功能

適用於 VM 的 Azure 監視器對應功能會從 Microsoft Dependency Agent 取得其資料。 適用於 Linux 的 Azure VM 相依性代理程式虛擬機器擴充功能會在 Azure 虛擬機器上安裝相依性代理程式。 此文件詳細說明適用於 Linux 的 Azure VM 相依性代理程式虛擬機器擴充功能所支援的平台、組態和部署選項。

必要條件

作業系統

由於 Azure VM 相依性代理程式在核心層級運作,因此作業系統支援也相依於核心版本。 從 Dependency Agent 9.10.* 版起,代理程式支援 * 個核心。 下表列出 Dependency Agent 的主要和次要 Linux OS 版本和支援的核心版本。

注意

使用 Dependency Agent 9.10.15 和更新版本時,不會針對不支援的核心版本封鎖安裝,但代理程式會以降級模式執行。 在此模式中,不會收集儲存在 VMConnection 和 VMBoundport 資料表中的連線和連接埠資料。 VMProcess 資料表可能會有一些資料,但會是最少量的資料。

Distribution 作業系統版本 核心版本
Red Hat Linux 8 8.6 4.18.0-372.*el8.x86_64, 4.18.0-372.*el8_6.x86_64
8.5 4.18.0-348.*el8_5.x86_644.18.0-348.*el8.x86_64
8.4 4.18.0-305.*el8.x86_64, 4.18.0-305.*el8_4.x86_64
8.3 4.18.0-240.*el8_3.x86_64
8.2 4.18.0-193.*el8_2.x86_64
8.1 4.18.0-147.*el8_1.x86_64
8.0 4.18.0-80.*el8.x86_64
4.18.0-80.*el8_0.x86_64
Red Hat Linux 7 7.9 3.10.0-1160
7.8 3.10.0-1136
7.7 3.10.0-1062
7.6 3.10.0-957
7.5 3.10.0-862
7.4 3.10.0-693
Red Hat Linux 6 6.10 2.6.32-754
6.9 2.6.32-696
CentOS Linux 8 8.6 4.18.0-372.*el8.x86_64, 4.18.0-372.*el8_6.x86_64
8.5 4.18.0-348.*el8_5.x86_644.18.0-348.*el8.x86_64
8.4 4.18.0-305.*el8.x86_64, 4.18.0-305.*el8_4.x86_64
8.3 4.18.0-240.*el8_3.x86_64
8.2 4.18.0-193.*el8_2.x86_64
8.1 4.18.0-147.*el8_1.x86_64
8.0 4.18.0-80.*el8.x86_64
4.18.0-80.*el8_0.x86_64
CentOS Linux 7 7.9 3.10.0-1160
7.8 3.10.0-1136
7.7 3.10.0-1062
CentOS Linux 6 6.10 2.6.32-754.3.5
2.6.32-696.30.1
6.9 2.6.32-696.30.1
2.6.32-696.18.7
Ubuntu Server 20.04 5.8
5.4*
18.04 5.3.0-1020
5.0 (包括Azure 微調的核心)
4.18*
4.15*
16.04.3 4.15.*
16.04 4.13.*
4.11.*
4.10.*
4.8.*
4.4.*
14.04 3.13.*-通用
4.4.*-通用
SUSE Linux 12 Enterprise Server 12 SP5 4.12.14-122.*-預設,4.12.14-16.*-Azure
12 SP4 4.12.* (包括Azure 微調的核心)
12 SP3 4.4.*
12 SP2 4.4.*
SUSE Linux 15 Enterprise Server 15 SP1 4.12.14-197.*-default, 4.12.14-8.*-azure
15 4.12.14-150.*-default
Debian 9 4.9

注意

使用 Ampere Altra ARM 型處理器的 Azure 虛擬機器不支援相依性代理程式。

擴充功能結構描述

下列 JSON 顯示 Azure Linux VM 上 Azure VM 相依性代理程式擴充功能的結構描述。

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
      "vmName": {
        "type": "string",
        "metadata": {
            "description": "The name of existing Linux Azure VM."
      }
    }
  },
  "variables": {
      "vmExtensionsApiVersion": "2017-03-30"
  },
  "resources": [
    {
      "type": "Microsoft.Compute/virtualMachines/extensions",
      "name": "[concat(parameters('vmName'),'/DAExtension')]",
      "apiVersion": "[variables('vmExtensionsApiVersion')]",
      "location": "[resourceGroup().location]",
      "dependsOn": [],
      "properties": {
          "publisher": "Microsoft.Azure.Monitoring.DependencyAgent",
          "type": "DependencyAgentLinux",
          "typeHandlerVersion": "9.5",
          "autoUpgradeMinorVersion": true,
          "settings": {
              "enableAMA": "true"
        }
      }
    }
  ],
    "outputs": {
    }
}

屬性值

名稱 值/範例
apiVersion 2015-01-01
publisher Microsoft.Azure.Monitoring.DependencyAgent
type DependencyAgentLinux
typeHandlerVersion 9.5
設定 "enableAMA":"true"

重要

如果您使用 Azure 監視器代理程式,請務必將 enableAMA 新增至範本,否則相依性代理程式會嘗試將資料傳送至舊版 Log Analytics 代理程式。

範本部署

您可以使用 Azure Resource Manager 範本部署 Azure VM 擴充功能。 在部署 Azure Resource Manager 範本時,您可以在 Azure Resource Manager 範本中使用上一節詳述的 JSON 結構描述來執行 Azure VM 相依性代理程式擴充功能。

虛擬機器擴充功能的 JSON 能以巢狀方式置於虛擬機器資源內部。 或者,您可以將其放在 Resource Manager JSON 範本的根目錄層或最上層。 JSON 的放置會影響資源名稱和類型的值。 如需詳細資訊,請參閱設定子資源的名稱和類型

下列範例假設相依性代理程式擴充功能以巢狀方式置於虛擬機器資源內部。 當您以巢狀方式安置擴充功能資源時,JSON 會放在虛擬機器的 "resources": [] 物件中。

{
	"type": "extensions",
	"name": "DAExtension",
	"apiVersion": "[variables('apiVersion')]",
	"location": "[resourceGroup().location]",
	"dependsOn": [
      "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
	],
	"properties": {
        "publisher": "Microsoft.Azure.Monitoring.DependencyAgent",
        "type": "DependencyAgentLinux",
        "typeHandlerVersion": "9.5",
        "autoUpgradeMinorVersion": true,
        "settings": {
            "enableAMA": "true"
        }
	}
}

當您將擴充功能 JSON 放在範本的根目錄時,資源名稱會包含對父代虛擬機器的參考。 型別會反映以巢狀方式安置的設定。

{
	"type": "Microsoft.Compute/virtualMachines/extensions",
	"name": "<parentVmResource>/DAExtension",
	"apiVersion": "[variables('apiVersion')]",
	"location": "[resourceGroup().location]",
	"dependsOn": [
      "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
	],
	"properties": {
        "publisher": "Microsoft.Azure.Monitoring.DependencyAgent",
        "type": "DependencyAgentLinux",
        "typeHandlerVersion": "9.5",
        "autoUpgradeMinorVersion": true,
        "settings": {
            "enableAMA": "true"
        }
	}
}

Azure CLI 部署

您可以使用 Azure CLI,將相依性代理程式 VM 擴充功能部署到現有的虛擬機器。


az vm extension set \
    --resource-group myResourceGroup \
    --vm-name myVM \
    --name DependencyAgentLinux \
    --publisher Microsoft.Azure.Monitoring.DependencyAgent \
    --version 9.5

自動升級擴充功能

現在已可使用相依性延伸模組的自動升級次要版本新功能。

若要啟用延伸模組的自動延伸模組更新,您必須確定 enableAutomaticUpgrade 屬性已設定為 true,並新增至延伸模組範本。 此屬性必須個別在每部 VM 或 VM 擴展集上啟用。 使用啟用一節中所述的其中一種方法,為您的 VM 或 VM 擴展集啟用此功能。

在 VM 或 VM 擴展集上啟用自動延伸模組更新時,每當延伸模組發行者發行該延伸模組的新版本時,就會自動升級延伸模組。 升級會遵循可用性優先的原則安全地套用,如這裡所述。

enableAutomaticUpgrade 屬性的功能與 autoUpgradeMinorVersion 的功能不同。 當延伸模組發行者發行新版本時,autoUpgradeMinorVersion 屬性不會自動觸發次要版本更新。 autoUpgradeMinorVersion 屬性會指出延伸模組是否應該在部署期間有較新的次要版本可用時,使用該版本。 不過,部署之後,除非重新部署延伸模組,否則延伸模組將不會升級次要版本,即使此屬性設定為 true 亦然。

若要讓您的延伸模組版本保持更新,建議您搭配延伸模組部署使用 enableAutomaticUpgrade

重要

如果您將 enableAutomaticUpgrade 新增至範本,請確定您是在 API 2019-12-01 版或更高版本中使用。

疑難排解與支援

疑難排解

您可以使用 Azure CLI 從 Azure 入口網站擷取有關擴充功能部署狀態的資料。 若要查看指定 VM 的擴充功能部署狀態,請使用 Azure CLI 執行下列命令:

az vm extension list --resource-group myResourceGroup --vm-name myVM -o table

擴充功能執行輸出會記錄至下列檔案︰

/var/opt/microsoft/dependency-agent/log/install.log

支援

如果您在如果您在本文中有任何需要協助的地方,請連絡 Microsoft 問 & 答和 Stack Overflow 論壇上的 Azure 專家。 或者,您也可以提出 Azure 支援事件。 請移至 Azure 支援網站,然後選取 [取得支援]。 如需如何使用 Azure 支援的相關資訊,請參閱 Microsoft Azure 支援常見問題集