0

Ubunutu 14.04 マシンの ARM テンプレートを介して収集する基本的なメトリックを有効にしようとしています。

テンプレートの vm セクションに以下のようなセクションがあります。

"resources": [  {
      "name": "Microsoft.Insights.VMDiagnosticsSettings",
      "type": "extensions",
      "location": "[resourceGroup().location]",
      "apiVersion": "[variables('apiVersion')]",
      "dependsOn": [
        "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
      ],
      "tags": {
        "displayName": "AzureDiagnostics"
      },
      "properties": {
        "publisher": "Microsoft.OSTCExtensions",
        "type": "LinuxDiagnostic",
        "typeHandlerVersion": "2.3",
        "autoUpgradeMinorVersion": true,
        "protectedSettings": {
          "storageAccountName": "[parameters('metricsStorageAccountName')]",
          "storageAccountKey": "[listkeys(variables('accountid'), variables('apiVersion')).key1]",
          "storageAccountEndPoint": "https://core.windows.net"
        }
      }
    }]

アプローチをリバース エンジニアリングするためにポータルからテンプレートをエクスポートしようとしましたが、エクスポートされたテンプレートには診断セクションが含まれていません。

基本メトリックを有効にし、VM でアラートを作成できるようにするには、他に何が必要ですか?

4

1 に答える 1

3

テンプレートのエクスポート オプションにはLinuxDiagnostics拡張子が含まれていないため、手動でテンプレートに追加する必要があります。

指定したテンプレート:

"resources": [  {
  "name": "Microsoft.Insights.VMDiagnosticsSettings",
  "type": "extensions",
  "location": "[resourceGroup().location]",
  "apiVersion": "[variables('apiVersion')]",
  "dependsOn": [
    "[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
  ],
  "tags": {
    "displayName": "AzureDiagnostics"
  },
  "properties": {
    "publisher": "Microsoft.OSTCExtensions",
    "type": "LinuxDiagnostic",
    "typeHandlerVersion": "2.3",
    "autoUpgradeMinorVersion": true,
    "protectedSettings": {
      "storageAccountName": "[parameters('metricsStorageAccountName')]",
      "storageAccountKey": "[listkeys(variables('accountid'), variables('apiVersion')).key1]",
      "storageAccountEndPoint": "https://core.windows.net"
    }
  }
}]

拡張機能を追加しますが、azure ポータルで監視グラフを表示することはできず、アラート ルールを作成することもできません。これは、サポート ドキュメント (重要な通知ヘッダーの下) で説明されているとおりです: Linux Diagnostics Github ページ

ただし、グラフを表示できるように拡張機能を追加する回避策があります。このために、2 つの VM を作成し、ポータルを使用して最初の VM に拡張機能を追加し、上記のようにテンプレート形式を使用して 2 番目の VM に拡張機能を追加しました。次に、Azure CLI を使用して、両方の拡張機能の詳細を JSON 形式で取得しました。最初の VM の拡張機能の詳細は次のとおりです。

C:\Users\gkapagun\Downloads\ExportedTemplate>azure vm extension get --json <resource-group-name> <vm-name>
[
  {
    "id": "/subscriptions/<subscription_id>/resourceGroups/<resource-group-name>/providers/Microsoft.Compute/virtualMachines/<vm-name>/extensions/LinuxDiagnostic",
    "name": "LinuxDiagnostic",
    "type": "Microsoft.Compute/virtualMachines/extensions",
    "location": "eastus2",
    "publisher": "Microsoft.OSTCExtensions",
    "virtualMachineExtensionType": "LinuxDiagnostic",
    "typeHandlerVersion": "2.3",
    "autoUpgradeMinorVersion": true,
    "settings": {
      "StorageAccount": "<storage-account-name>",
      "xmlCfg": "PFdhZENmZz48RGlhZ25vc3RpY01vbml0b3JDb25maWd1cmF0aW9uIG92ZXJhbGxRdW90YUluTUI9IjQwOTYiPjxEaWFnbm9zdGljSW5mcmFzdHJ1Y3R1cmVMb2dzIHNjaGVkdWxlZFRyYW5zZmVyUGVyaW9kPSJQVDFNIiBzY2hlZHVsZWRUcmFuc2ZlckxvZ0xldmVsRmlsdGVyPSJXYXJuaW5nIi8+PFBlcmZvcm1hbmNlQ291bnRlcnMgc2NoZWR1bGVkVHJhbnNmZXJQZXJpb2Q9IlBUMU0iPjxQZXJmb3JtYW5jZUNvdW50ZXJDb25maWd1cmF0aW9uIGNvdW50ZXJTcGVjaWZpZXI9IlxNZW1vcnlcQXZhaWxhYmxlTWVtb3J5IiBzYW1wbGVSYXRlPSJQVDE1UyIgdW5pdD0iQnl0ZXMiPjxhbm5vdGF0aW9uIGRpc3BsYXlOYW1lPSJNZW1vcnkgYXZhaWxhYmxlIiBsb2Nh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SEVUSUJEMDAyIj48TWV0cmljQWdncmVnYXRpb24gc2NoZWR1bGVkVHJhbnNmZXJQZXJpb2Q9IlBUMUgiLz48TWV0cmljQWdncmVnYXRpb24gc2NoZWR1bGVkVHJhbnNmZXJQZXJpb2Q9IlBUMU0iLz48L01ldHJpY3M+PC9EaWFnbm9zdGljTW9uaXRvckNvbmZpZ3VyYXRpb24+PC9XYWRDZmc+"
    },
    "provisioningState": "Succeeded"
  }
]

C:\Users\gkapagun\Downloads\ExportedTemplate>

2 番目の VM の場合:

C:\Users\gkapagun\Downloads\ExportedTemplate>azure vm extension get --json <resource-group-name> <vm-name>
[
  {
    "id": "/subscriptions/<subscription_id>/resourceGroups/<resource-group-name>/providers/Microsoft.Compute/virtualMachines/<vm-name>/extensions/LinuxDiagnostic",
    "name": "LinuxDiagnostic",
    "type": "Microsoft.Compute/virtualMachines/extensions",
    "location": "eastus2",
    "publisher": "Microsoft.OSTCExtensions",
    "virtualMachineExtensionType": "LinuxDiagnostic",
    "typeHandlerVersion": "2.3",
    "autoUpgradeMinorVersion": true,
    "provisioningState": "Succeeded"
  }
]

C:\Users\gkapagun\Downloads\ExportedTemplate>

違いは、設定の提供方法、特にxmlCfgキーです。

これxmlCfgは、メトリクスの収集方法で構成される base64 でエンコードされた文字列に他なりません。デコードすると、次の XML データを取得できました。

<?xml version="1.0" encoding="UTF-8"?>
<WadCfg>
   <DiagnosticMonitorConfiguration overallQuotaInMB="4096">
      <DiagnosticInfrastructureLogs scheduledTransferPeriod="PT1M" scheduledTransferLogLevelFilter="Warning" />
      <PerformanceCounters scheduledTransferPeriod="PT1M">
         <PerformanceCounterConfiguration counterSpecifier="\Memory\AvailableMemory" sampleRate="PT15S" unit="Bytes">
            <annotation displayName="Memory available" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\Memory\PercentAvailableMemory" sampleRate="PT15S" unit="Percent">
            <annotation displayName="Mem. percent available" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\Memory\UsedMemory" sampleRate="PT15S" unit="Bytes">
            <annotation displayName="Memory used" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\Memory\PercentUsedMemory" sampleRate="PT15S" unit="Percent">
            <annotation displayName="Memory percentage" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\Memory\PercentUsedByCache" sampleRate="PT15S" unit="Percent">
            <annotation displayName="Mem. used by cache" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\Memory\PagesPerSec" sampleRate="PT15S" unit="CountPerSecond">
            <annotation displayName="Pages" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\Memory\PagesReadPerSec" sampleRate="PT15S" unit="CountPerSecond">
            <annotation displayName="Page reads" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\Memory\PagesWrittenPerSec" sampleRate="PT15S" unit="CountPerSecond">
            <annotation displayName="Page writes" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\Memory\AvailableSwap" sampleRate="PT15S" unit="Bytes">
            <annotation displayName="Swap available" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\Memory\PercentAvailableSwap" sampleRate="PT15S" unit="Percent">
            <annotation displayName="Swap percent available" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\Memory\UsedSwap" sampleRate="PT15S" unit="Bytes">
            <annotation displayName="Swap used" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\Memory\PercentUsedSwap" sampleRate="PT15S" unit="Percent">
            <annotation displayName="Swap percent used" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\Processor\PercentIdleTime" sampleRate="PT15S" unit="Percent">
            <annotation displayName="CPU idle time" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\Processor\PercentUserTime" sampleRate="PT15S" unit="Percent">
            <annotation displayName="CPU user time" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\Processor\PercentNiceTime" sampleRate="PT15S" unit="Percent">
            <annotation displayName="CPU nice time" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\Processor\PercentPrivilegedTime" sampleRate="PT15S" unit="Percent">
            <annotation displayName="CPU privileged time" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\Processor\PercentInterruptTime" sampleRate="PT15S" unit="Percent">
            <annotation displayName="CPU interrupt time" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\Processor\PercentDPCTime" sampleRate="PT15S" unit="Percent">
            <annotation displayName="CPU DPC time" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\Processor\PercentProcessorTime" sampleRate="PT15S" unit="Percent">
            <annotation displayName="CPU percentage guest OS" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\Processor\PercentIOWaitTime" sampleRate="PT15S" unit="Percent">
            <annotation displayName="CPU IO wait time" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\PhysicalDisk\BytesPerSecond" sampleRate="PT15S" unit="BytesPerSecond">
            <annotation displayName="Disk total bytes" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\PhysicalDisk\ReadBytesPerSecond" sampleRate="PT15S" unit="BytesPerSecond">
            <annotation displayName="Disk read guest OS" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\PhysicalDisk\WriteBytesPerSecond" sampleRate="PT15S" unit="BytesPerSecond">
            <annotation displayName="Disk write guest OS" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\PhysicalDisk\TransfersPerSecond" sampleRate="PT15S" unit="CountPerSecond">
            <annotation displayName="Disk transfers" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\PhysicalDisk\ReadsPerSecond" sampleRate="PT15S" unit="CountPerSecond">
            <annotation displayName="Disk reads" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\PhysicalDisk\WritesPerSecond" sampleRate="PT15S" unit="CountPerSecond">
            <annotation displayName="Disk writes" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\PhysicalDisk\AverageReadTime" sampleRate="PT15S" unit="Seconds">
            <annotation displayName="Disk read time" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\PhysicalDisk\AverageWriteTime" sampleRate="PT15S" unit="Seconds">
            <annotation displayName="Disk write time" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\PhysicalDisk\AverageTransferTime" sampleRate="PT15S" unit="Seconds">
            <annotation displayName="Disk transfer time" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\PhysicalDisk\AverageDiskQueueLength" sampleRate="PT15S" unit="Count">
            <annotation displayName="Disk queue length" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\NetworkInterface\BytesTransmitted" sampleRate="PT15S" unit="Bytes">
            <annotation displayName="Network out guest OS" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\NetworkInterface\BytesReceived" sampleRate="PT15S" unit="Bytes">
            <annotation displayName="Network in guest OS" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\NetworkInterface\PacketsTransmitted" sampleRate="PT15S" unit="Count">
            <annotation displayName="Packets sent" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\NetworkInterface\PacketsReceived" sampleRate="PT15S" unit="Count">
            <annotation displayName="Packets received" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\NetworkInterface\BytesTotal" sampleRate="PT15S" unit="Bytes">
            <annotation displayName="Network total bytes" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\NetworkInterface\TotalRxErrors" sampleRate="PT15S" unit="Count">
            <annotation displayName="Packets received errors" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\NetworkInterface\TotalTxErrors" sampleRate="PT15S" unit="Count">
            <annotation displayName="Packets sent errors" locale="en-us" />
         </PerformanceCounterConfiguration>
         <PerformanceCounterConfiguration counterSpecifier="\NetworkInterface\TotalCollisions" sampleRate="PT15S" unit="Count">
            <annotation displayName="Network collisions" locale="en-us" />
         </PerformanceCounterConfiguration>
      </PerformanceCounters>
      <Metrics resourceId="<vm URI>">
         <MetricAggregation scheduledTransferPeriod="PT1H" />
         <MetricAggregation scheduledTransferPeriod="PT1M" />
      </Metrics>
   </DiagnosticMonitorConfiguration>
</WadCfg>

したがって、拡張機能のリソース テンプレートは次のようにする必要があります。

{
    "type": "Microsoft.Compute/virtualMachines/extensions",
    "name": "[concat(parameters('virtualMachine_name'),'/LinuxDiagnostic')]",
    "apiVersion": "2015-05-01-preview",
    "location": "[resourceGroup().location]",
    "dependsOn": ["[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachine_name'))]"],
    "properties": {
        "publisher": "Microsoft.OSTCExtensions",
        "type": "LinuxDiagnostic",
        "typeHandlerVersion": "2.3",
        "autoUpgradeMinorVersion":true,
        "settings": {
            "storageAccount" : "[parameters('storageAccount_name')]",
            "xmlCfg" : "[parameters('extensionXMLCfg')]"
        },
        "protectedSettings": {
            "storageAccountName": "[parameters('storageAccount_name')]",
            "storageAccountKey": "<key>",
            "storageAccountEndPoint": "https://core.windows.net"
        }
    }
}

ここで、パラメーターextensionXMLCfgは、VM URI が指定された base64 でエンコードされた XML データです。

これにより、アラートルールもテンプレートに追加できます。

于 2016-09-07T08:13:13.777 に答える