gpt4 book ai didi

linux - 使用 ARM 模板设置 Linux 诊断扩展

转载 作者:可可西里 更新时间:2023-11-01 11:51:26 26 4
gpt4 key购买 nike

您好,我正在尝试创建一个 ARM 模板,以便使用 ARM 模板在我的 Linux VM 上设置 Azure Linux 诊断扩展来监视安装点。

我引用以下文档来实现相同的目的:

https://learn.microsoft.com/en-us/azure/virtual-machines/extensions/diagnostics-template

但是,在研究 Microsoft 提供的其他文档时,我发现 Windows 和 Linux 诊断代理具有不同的监控参数。

Windows:https://learn.microsoft.com/en-us/azure/virtual-machines/extensions/diagnostics-windows

Linux:https://learn.microsoft.com/en-us/azure/virtual-machines/extensions/diagnostics-linux

适用于 Windows 的 ARM JSON 是:

"resources": [
{
"name": "Microsoft.Insights.VMDiagnosticsSettings",
"type": "extensions",
"location": "[resourceGroup().location]",
"apiVersion": "2015-06-15",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
],
"tags": {
"displayName": "AzureDiagnostics"
},
"properties": {
"publisher": "Microsoft.Azure.Diagnostics",
"type": "IaaSDiagnostics",
"typeHandlerVersion": "1.5",
"autoUpgradeMinorVersion": true,
"settings": {
"xmlCfg": "[base64(concat(variables('wadcfgxstart'), variables('wadmetricsresourceid'), variables('vmName'), variables('wadcfgxend')))]",
"storageAccount": "[parameters('existingdiagnosticsStorageAccountName')]"
},
"protectedSettings": {
"storageAccountName": "[parameters('existingdiagnosticsStorageAccountName')]",
"storageAccountKey": "[listkeys(variables('accountid'), '2015-05-01-preview').key1]",
"storageAccountEndPoint": "https://core.windows.net"
}
}
}
]

有人知道 Linux 诊断代理的“settings”和“protectedSettings”是什么吗?

最佳答案

我在这里回答我自己的问题。

与适用于 Windows 的 Azure 诊断代理进行比较时的差异是:

  1. type 位于properties 下。这将对应于 LinuxDiagnostic 而不是 IaaSDiagnostics
  2. typehandlerversion:这基本上是 LAD 版本。最新的是3.0
  3. protectedSettings:可以用以下方式编写:

    {
    "storageAccountName": "接收数据的存储帐户",
    "storageAccountEndPoint": "此帐户的云主机名后缀",
    "storageAccountSasToken": "SAS 访问 token ",
    "mdsdHttpProxy": "HTTP 代理设置",
    “sinksConfig”:{ ... }
    }

mdsdHttpProxy和sinksConfig参数是可选的,只有在进行了相同设置后才需要配置。有关这方面的更多信息可以找到here (在 protected 设置部分)。

  • 设置:这将采用以下形式:

    {
    “ladCfg”:{...},
    “perfCfg”:{...},
    “文件日志”:{...},
    "StorageAccount": "接收数据的存储帐户",
    “mdsdHttpProxy”:“”
    }

  • 每一项都已详细讨论过 here (在公共(public)场合)。

    对我有用的 Linux 诊断扩展示例如下:

    "resources": [
    {
    "type": "Microsoft.Compute/virtualMachines/extensions",
    "apiVersion": "2017-12-01",
    "location": "[resourceGroup().location]",
    "name": "[concat(variables('vmName'), '/Microsoft.Insights.VMDiagnosticSettings')]",
    "tags": {
    "displayName": "AzureDiagnostics"
    },
    "properties": {
    "publisher": "Microsoft.Azure.Diagnostics",
    "type": "LinuxDiagnostic",
    "autoUpgradeMinorVersion": true,
    "typeHandlerVersion": "3.0",
    "protectedSettings": {
    "storageAccountName": "[parameters('storageAccountName')]",
    "storageAccountEndPoint": "https://core.windows.net",
    "storageAccountSasToken": "[parameters('sasToken')]"
    },
    "settings": {
    "StorageAccount": "[parameters('storageAccountName')]",
    "ladCfg": {
    "diagnosticMonitorConfiguration": {
    "syslogEvents": {},
    "sampleRateInSeconds": 15,
    "eventVolume": "Medium",
    "metrics": {
    "resourceId": "[resourceId('Microsoft.Compute/virtualMachines', variables('vmName'))]",
    "metricAggregation": [
    { "scheduledTransferPeriod": "PT1H" },
    { "scheduledTransferPeriod": "PT1M" }
    ]
    },
    "performanceCounters": {
    "performanceCounterConfiguration": [
    {
    "annotation": [
    {
    "displayName": "Filesystem % free space",
    "locale": "en-us"
    }
    ],
    "class": "filesystem",
    "condition": "IsAggregate=TRUE",
    "counter": "percentfreespace",
    "counterSpecifier": "/builtin/filesystem/percentfreespace",
    "type": "builtin",
    "unit": "Percent"
    },
    {
    "annotation": [
    {
    "displayName": "Filesystem % used space",
    "locale": "en-us"
    }
    ],
    "class": "filesystem",
    "condition": "IsAggregate=TRUE",
    "counter": "percentusedspace",
    "counterSpecifier": "/builtin/filesystem/percentusedspace",
    "type": "builtin",
    "unit": "Percent"
    },
    {
    "annotation": [
    {
    "displayName": "Filesystem used space",
    "locale": "en-us"
    }
    ],
    "class": "filesystem",
    "condition": "IsAggregate=TRUE",
    "counter": "usedspace",
    "counterSpecifier": "/builtin/filesystem/usedspace",
    "type": "builtin",
    "unit": "Bytes"
    },
    {
    "annotation": [
    {
    "displayName": "Filesystem read bytes/sec",
    "locale": "en-us"
    }
    ],
    "class": "filesystem",
    "condition": "IsAggregate=TRUE",
    "counter": "bytesreadpersecond",
    "counterSpecifier": "/builtin/filesystem/bytesreadpersecond",
    "type": "builtin",
    "unit": "CountPerSecond"
    },
    {
    "annotation": [
    {
    "displayName": "Filesystem free space",
    "locale": "en-us"
    }
    ],
    "class": "filesystem",
    "condition": "IsAggregate=TRUE",
    "counter": "freespace",
    "counterSpecifier": "/builtin/filesystem/freespace",
    "type": "builtin",
    "unit": "Bytes"
    },
    {
    "annotation": [
    {
    "displayName": "Filesystem % free inodes",
    "locale": "en-us"
    }
    ],
    "class": "filesystem",
    "condition": "IsAggregate=TRUE",
    "counter": "percentfreeinodes",
    "counterSpecifier": "/builtin/filesystem/percentfreeinodes",
    "type": "builtin",
    "unit": "Percent"
    }
    ]
    }
    }
    }
    }
    }
    }
    ]

    关于linux - 使用 ARM 模板设置 Linux 诊断扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51961424/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com