我尝试将缩放设置应用于模板化部署中的可用性集。我无法在azure-quickstart-templates中找到这个特定用例的完整示例来进行比较,而错误语法的错误是一个无法提供信息的BadRequest'没有其他信息。
这是我的模板中的自动缩放设置(否则会部署正常)......
{
"apiVersion": "2014-04-01",
"dependsOn": [
"Microsoft.Compute/availabilitySets/workersas"
],
"location": "[resourceGroup().location]",
"name": "workersscaling",
"properties": {
"enabled": true,
"name": "workersscaling",
"profiles": [
{
"capacity": {
"default": 2,
"maximum": 4,
"minimum": 2
},
"name": "Default",
"rules": [
{
"metricTrigger": {
"metricName": "Percentage CPU",
"metricNamespace": "",
"metricResourceUri": "[resourceId('Microsoft.Compute/availabilitySets', 'workersas')]",
"operator": "GreaterThan",
"statistic": "Average",
"threshold": 80.0,
"timeAggregation": "Average",
"timeGrain": "PT1M",
"timeWindow": "PT10M"
},
"scaleAction": {
"cooldown": "PT10M",
"direction": "Increase",
"type": "ChangeCount",
"value": "1"
}
},
{
"metricTrigger": {
"metricName": "Percentage CPU",
"metricNamespace": "",
"metricResourceUri": "[resourceId('Microsoft.Compute/availabilitySets', 'workersas')]",
"operator": "LessThan",
"statistic": "Average",
"threshold": 40.0,
"timeAggregation": "Average",
"timeGrain": "PT1M",
"timeWindow": "PT10M"
},
"scaleAction": {
"cooldown": "PT10M",
"direction": "Decrease",
"type": "ChangeCount",
"value": "1"
}
}
]
}
],
"targetResourceUri": "[resourceId('Microsoft.Compute/availabilitySets', 'workersas')]"
},
"type": "microsoft.insights/autoscalesettings"
}
有没有人有任何见解?我已根据快速入门库中找到的网站服务的response format found here和自动缩放示例构建了此内容。
编辑:
尝试使用Azure CLI工具的更多信息......
~/ $ azure insights metrics definition list /subscriptions/.../resourceGroups/snrg/providers/Microsoft.Compute/availabilitySets/workersasinfo: Executing command insights metrics definition list
+ Querying ""
error: No registered resource provider found for location 'northeurope' and API version '2014-04-01' for type 'availabilitySets'. The supported api-versions are '2014-12-01-preview, 2015-05-01-preview, 2015-06-15'. The supported locations are 'eastus, eastus2, westus, centralus, southcentralus, northeurope, westeurope, eastasia, southeastasia, japaneast, japanwest'.
或许我现在尝试做的事情是不可能的?
答案 0 :(得分:0)
Azure PowerShell模块尚不支持Azure Autoscale属性的直接配置,因此我们希望将Azure PowerShell和Azure Service Management REST API操作的组合用于Autoscaling。 REST API提供添加,删除,更新和检索自动缩放配置的操作。
希望这会对你有所帮助。
Girish Prajwal
答案 1 :(得分:0)
我在你的模板中看到了一些问题。这是一个有效的。请记住,您至少需要S1 App Service计划才能看到自动缩放:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string"
},
"serverFarmName": {
"type": "string"
},
"capacityDefault": {
"type": "string",
"defaultValue": "1"
},
"capacityMinimum": {
"type": "string",
"defaultValue": "1"
},
"capacityMaximum": {
"type": "string",
"defaultValue": "10"
}
},
"resources": [
{
"apiVersion": "2015-04-01",
"name": "[parameters('serverFarmName')]",
"type": "Microsoft.Insights/autoscalesettings",
"location": "[parameters('location')]",
"properties": {
"profiles": [
{
"name": "Default",
"capacity": {
"default": "[parameters('capacityDefault')]",
"maximum": "[parameters('capacityMaximum')]",
"minimum": "[parameters('capacityMinimum')]"
},
"rules": [
{
"metricTrigger": {
"metricName": "CpuPercentage",
"metricNamespace": "",
"metricResourceUri": "[resourceId('Microsoft.Web/serverfarms/', parameters('serverFarmName'))]",
"timeGrain": "PT1M",
"statistic": "Max",
"timeWindow": "PT5M",
"timeAggregation": "Average",
"operator": "GreaterThan",
"threshold": 45
},
"scaleAction": {
"direction": "Increase",
"type": "ChangeCount",
"value": "2",
"cooldown": "PT5M"
}
},
{
"metricTrigger": {
"metricName": "MemoryPercentage",
"metricNamespace": "",
"metricResourceUri": "[resourceId('Microsoft.Web/serverfarms/', parameters('serverFarmName'))]",
"timeGrain": "PT1M",
"statistic": "Max",
"timeWindow": "PT5M",
"timeAggregation": "Average",
"operator": "GreaterThan",
"threshold": 75
},
"scaleAction": {
"direction": "Increase",
"type": "ChangeCount",
"value": "2",
"cooldown": "PT5M"
}
},
{
"metricTrigger": {
"metricName": "HttpQueueLength",
"metricNamespace": "",
"metricResourceUri": "[resourceId('Microsoft.Web/serverfarms/', parameters('serverFarmName'))]",
"timeGrain": "PT1M",
"statistic": "Max",
"timeWindow": "PT5M",
"timeAggregation": "Average",
"operator": "GreaterThen",
"threshold": 100
},
"scaleAction": {
"direction": "Increase",
"type": "ChangeCount",
"value": "2",
"cooldown": "PT5M"
}
},
{
"metricTrigger": {
"metricName": "CpuPercentage",
"metricNamespace": "",
"metricResourceUri": "[resourceId('Microsoft.Web/serverfarms/', parameters('serverFarmName'))]",
"timeGrain": "PT1M",
"statistic": "Max",
"timeWindow": "PT5M",
"timeAggregation": "Average",
"operator": "LessThan",
"threshold": 15
},
"scaleAction": {
"direction": "Decrease",
"type": "ChangeCount",
"value": "1",
"cooldown": "PT5M"
}
}
]
}
],
"enabled": true,
"name": "[parameters('serverFarmName')]",
"targetResourceUri": "[resourceId('Microsoft.Web/serverfarms/', parameters('serverFarmName'))]"
}
}
]
}