使用手臂模板进行自动缩放设置的问题 [英] Issue with auto scaling setting using arm template

查看:60
本文介绍了使用手臂模板进行自动缩放设置的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

{
"$ schema":"http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json# " ;,
"contentVersion":"1.0.0.0",
参数":{
名称":{
"type":"String"
},
"hostingPlanName":{
"type":"String"
},
位置":{
"type":"String"
},
"sku":{
"type":"String"
},
"skuCode":{
"type":"String"
},
"workerSize":{
"type":"String"
},
"metricThresholdToScaleOut":{
"type":"String"
},
"metricThresholdToScaleIn":{
"type":"String"
},
"serverFarmResourceGroup":{
"type":"String"
},
"subscriptionId":{
"type":"String"
}
},
资源":[
{
类型":"Microsoft.Web/sites",
名称":"[parameters('name')]",
" apiVersion" ;:" 2015-04-01" ;,
位置":"[[parameters('location')]]",
属性":{
名称":"[parameters('name')]",                
"siteConfig":{
"clientAffinityEnabled":"false",
"alwaysOn":"true",
"javaVersion":"1.8",
"javaContainer":"TOMCAT",
"javaContainerVersion":"8.5",
"appSettings":[]
},
"serverFarmId":"[concat('/subscriptions/',parameters('subscriptionId'),'/resourcegroups/',parameters('serverFarmResourceGroup' ),'/providers/Microsoft.Web/serverfarms/',parameters('hostingPlanName'))]"

},
"dependsOn":[
" [[concat('Microsoft.Web/serverfarms/',parameters('hostingPlanName'))];
]
},
{
  类型":"Microsoft.Web/serverfarms",
  " apiVersion" ;:" 2015-08-01" ;,
  "名称":"[parameters('hostingPlanName')]",
  "location":"[parameters('location')]",
  "sku":{
"name":"[[parameters('skuCode')]",
"tier":"[parameters('sku')]",
容量":1
  }
},
{
  类型":"Microsoft.Insights/autoscalesettings",
  "名称":"[parameters('hostingPlanName')]",
  "dependsOn":[
" [resourceId('Microsoft.Web/serverfarms',parameters('hostingPlanName'))]';
  ],
  " apiVersion" ;:" 2014-04-01" ;,
  "location":"[parameters('location')]",
  属性":{
个人资料":[
  {
名称":"DefaultAutoscaleProfile",
容量":{
  "minimum":"1",
  最大":"10",
  默认":"1"
},
规则":[
  {
"metricTrigger":{
  "metricName":"CpuPercentage",
  "metricResourceUri":"[resourceId('Microsoft.Web/serverfarms',parameters('hostingPlanName'))]",
  "timeGrain":"PT5M",
  "statistic":"Average",
  " timeWindow":"PT5M",
  "timeAggregation":"Average",
  " operator":"GreaterThan",
  阈值":"[parameters('metricThresholdToScaleOut')]"
},
"scaleAction":{
  方向":增加",
  " type":"ChangeCount",
  值":"1",
  冷却":"PT10M"
}
  },
  {
"metricTrigger":{
  "metricName":"CpuPercentage",
  "metricResourceUri":"[resourceId('Microsoft.Web/serverfarms',parameters('hostingPlanName'))]",
  "timeGrain":"PT5M",
  "statistic":"Average",
  " timeWindow":"PT15M",
  "timeAggregation":"Average",
  " operator":"LessThan",
  阈值":"[parameters('metricThresholdToScaleIn')]"
},
"scaleAction":{
  "direction":"Decrease",
  " type":"ChangeCount",
  值":"1",
  冷却":"PT10M"
}
  }
]
  }
],
已启用":"true"
   }
}
]
}

{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"type": "String"
},
"hostingPlanName": {
"type": "String"
},
"location": {
"type": "String"
},
"sku": {
"type": "String"
},
"skuCode": {
"type": "String"
},
"workerSize": {
"type": "String"
},
"metricThresholdToScaleOut": {
"type": "String"
},
"metricThresholdToScaleIn": {
"type": "String"
},
"serverFarmResourceGroup": {
"type": "String"
},
"subscriptionId": {
"type": "String"
}
},
"resources": [
{
"type": "Microsoft.Web/sites",
"name": "[parameters('name')]",
"apiVersion": "2015-04-01",
"location": "[parameters('location')]",
"properties": {
"name": "[parameters('name')]",                
"siteConfig": {
"clientAffinityEnabled": "false",
"alwaysOn": "true",
"javaVersion": "1.8",
"javaContainer": "TOMCAT",
"javaContainerVersion": "8.5",
"appSettings": []
},
"serverFarmId": "[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"

},
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
]
},
{
  "type": "Microsoft.Web/serverfarms",
  "apiVersion": "2015-08-01",
  "name": "[parameters('hostingPlanName')]",
  "location": "[parameters('location')]",
  "sku": {
"name": "[parameters('skuCode')]",
"tier": "[parameters('sku')]",
"capacity": 1
  }
},
{
  "type": "Microsoft.Insights/autoscalesettings",
  "name": "[parameters('hostingPlanName')]",
  "dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
  ],
  "apiVersion": "2014-04-01",
  "location": "[parameters('location')]",
  "properties": {
"profiles": [
  {
"name": "DefaultAutoscaleProfile",
"capacity": {
  "minimum": "1",
  "maximum": "10",
  "default": "1"
},
"rules": [
  {
"metricTrigger": {
  "metricName": "CpuPercentage",
  "metricResourceUri": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]",
  "timeGrain": "PT5M",
  "statistic": "Average",
  "timeWindow": "PT5M",
  "timeAggregation": "Average",
  "operator": "GreaterThan",
  "threshold": "[parameters('metricThresholdToScaleOut')]"
},
"scaleAction": {
  "direction": "Increase",
  "type": "ChangeCount",
  "value": "1",
  "cooldown": "PT10M"
}
  },
  {
"metricTrigger": {
  "metricName": "CpuPercentage",
  "metricResourceUri": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]",
  "timeGrain": "PT5M",
  "statistic": "Average",
  "timeWindow": "PT15M",
  "timeAggregation": "Average",
  "operator": "LessThan",
  "threshold": "[parameters('metricThresholdToScaleIn')]"
},
"scaleAction": {
  "direction": "Decrease",
  "type": "ChangeCount",
  "value": "1",
  "cooldown": "PT10M"
}
  }
]
  }
],
"enabled": "true"
   }
}
]
}

我试图创建webapp和appservice计划并尝试设置自动缩放规则,但是自动缩放规则却出错,因为创建了webapp和app服务计划.

i was trying to create webapp and appservice plan and trying to setup autoscaling rule, but autoscaling rule getting error, where as the webapp and app service plan is created.. Even i tried to change the api version am getting different error.

错误:

代码":"UnsupportedRequestContent",消息":请求内容格式不正确 或受支持." }

"code": "UnsupportedRequestContent", "message": "Request content is not well formed or supported." }

推荐答案

>

Could you please let us know if you are leveraging this template from any referenced Azure document or resource? Kindly ensure that you select the appropriate App Service Plan -Standard while provisioning and then check. I understand you have tried changing the api version, it looks like you are using different api version within the template in different places.
You could also use the JSON template available from the portal, see the section ‘View the scale definition of your resource’ and let us know how that goes for further investigation.

您可以类似于这种方式,根据您的要求适当修改模板,看看是否有帮助:
     "metricTrigger":{
              nbsp; bsp    "metricName":"CpuPercentage",
              nbsp; bsp    "metricNamespace":",
              nbsp; bsp    "metricResourceUri":"/subscriptions/x-xxx--xxxx-xxxxxxxxx/resourceGroups/AjayRG/providers/Microsoft.Web/serverFarms/AjayASP",
              nbsp; bsp    " operator":"GreaterThan",
              nbsp; bsp    "statistic":"Average",
              nbsp; bsp    阈值":70,
              nbsp; bsp    "timeAggregation":"Average",
              nbsp; bsp    "timeGrain":"PT1M",
              nbsp; bsp    "timeWindow":"PT10M"
               b }

You could modify the template appropriately based on your requirement similar to this way and see if that helps: 
      "metricTrigger": {
                            "metricName": "CpuPercentage",
                            "metricNamespace": "",
                            "metricResourceUri": "/subscriptions/x-xxx--xxxx-xxxxxxxxx/resourceGroups/AjayRG/providers/Microsoft.Web/serverFarms/AjayASP",
                            "operator": "GreaterThan",
                            "statistic": "Average",
                            "threshold": 70,
                            "timeAggregation": "Average",
                            "timeGrain": "PT1M",
                            "timeWindow": "PT10M"
                        }


这篇关于使用手臂模板进行自动缩放设置的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆