2016-11-09 2 views
1

Я использую шаблон ARM для программного создания веб-теста приложений и предупреждений Application Insights. Шаблон ARM основан на this article.Правило предупреждения в шаблоне Azure ARM не включено в веб-тесте

И веб-тест, и правило предупреждения созданы, но Оповещения свойство веб-теста отключено. Оповещения правила указано на правилах оповещения лезвия, но не в Webtests раздела, но в Других раздела, см фото:

enter image description here

Что мне не хватает для того, чтобы получить веб-тест с включенным предупреждением?

шаблон ARM (значение WebTest собственности удаляют SO):

 
{ 
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", 
    "contentVersion": "1.0.0.0", 
    "parameters": { 
    "webTestName": { 
     "type": "string" 
    }, 
    "appName": { "type": "string" } 
    }, 
    "variables": { 
    "url": "http://www.google.com", 
    "testName": "[concat(parameters('webTestName'), '-', toLower(parameters('appName')))]", 
    "alertRuleName": "[concat(parameters('webTestName'), '-', toLower(parameters('appName')), '-', subscription().subscriptionId)]" 
    }, 
    "resources": [ 
    { 
     "name": "[parameters('appName')]", 
     "type": "Microsoft.Insights/components", 
     "apiVersion": "2014-04-01", 
     "kind": "web", 
     "location": "Central US", 
     "properties": { 
     "Application_Type": "web", 
     "Flow_Type": "Redfield", 
     "Request_Source": "Unknown", 
     "Name": "[parameters('appName')]", 
     "PackageId": null, 
     "ApplicationId": "[parameters('appName')]" 
     }, 
     "tags": { 
     "applicationType": "web" 
     } 
    }, 
    { 
     "name": "[variables('testName')]", 
     "apiVersion": "2014-04-01", 
     "type": "microsoft.insights/webtests", 
     "location": "Central US", 
     "dependsOn": [ 
     "[resourceId('Microsoft.Insights/components', parameters('appName'))]" 
     ], 
     "tags": { 
     "[concat('hidden-link:', resourceId('Microsoft.Insights/components', parameters('appName')))]": "Resource" 
     }, 
     "properties": { 
     "Name": "[parameters('webTestName')]", 
     "Description": "description", 
     "Enabled": true, 
     "Frequency": 300, 
     "Timeout": 120, 
     "Kind": "ping", 
     "RetryEnabled": true, 
     "Locations": [ 
      { 
      "Id": "us-il-ch1-azr" 
      }, 
      { 
      "Id": "emea-se-sto-edge" 
      }, 
      { 
      "Id": "emea-nl-ams-azr" 
      } 
     ], 
     "Configuration": { 
      "WebTest": "[concat('          ')]" 
     }, 
     "SyntheticMonitorId": "[variables('testName')]" 
     } 
    }, 
    { 
     "name": "[variables('alertRuleName')]", 
     "apiVersion": "2014-04-01", 
     "type": "Microsoft.Insights/alertrules", 
     "location": "East US", 
     "dependsOn": [ 
     "[resourceId('Microsoft.Insights/webtests', variables('testName'))]" 
     ], 
     "tags": { 
     "[concat('hidden-link:', resourceId('microsoft.insights/components', parameters('appName')))]": "Resource", 
     "[concat('hidden-link:', resourceId('microsoft.insights/webtests', variables('testName')))]": "Resource" 
     }, 
     "properties": { 
     "name": "[variables('alertRuleName')]", 
     "description": "Alert for availability test", 
     "isEnabled": true, 
     "condition": { 
      "$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.LocationThresholdRuleCondition, Microsoft.WindowsAzure.Management.Mon.Client", 
      "odata.type": "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition", 
      "dataSource": { 
      "$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, Microsoft.WindowsAzure.Management.Mon.Client", 
      "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", 
      "resourceUri": "[resourceId('microsoft.insights/webtests', variables('testName'))]", 
      "metricName": "GSMT_AvRaW" 
      }, 
      "windowSize": "PT5M", 
      "failedLocationCount": 2 
     }, 
     "actions": [ 
      { 
      "$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, Microsoft.WindowsAzure.Management.Mon.Client", 
      "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", 
      "sendToServiceOwners": true, 
      "customEmails": [] 
      } 
     ] 
     } 
    } 
    ] 
} 

ответ

2

Оказалось, значение resourceUri является чувствительным к регистру. Решение:

"variables": { 
    ... 
    "testName": "[toLower(concat(parameters('webTestName'), '-', toLower(parameters('appName'))))]", 
    "alertRuleName": "[toLower(concat(parameters('webTestName'), '-', toLower(parameters('appName')), '-', subscription().subscriptionId))]" 
}, 
Смежные вопросы