AI ARM Yemplate部署 [英] AI ARM Yemplate deployment

查看:93
本文介绍了AI ARM Yemplate部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

如果我想通过ARM模板和可用性测试部署Application Insights,我可以将测试json添加到App Insights的末尾吗? json,还是他们必须单独运行?我有两个模板,但如果可能的话,我想以
运行。

If i want to deploy Application Insights via an ARM template as well as an Availability test, can i just add the test json to the end of the App Insights json, or do they have to be run separately? I have the templates for both, but wanted to run as one if possible.

谢谢

Shane

推荐答案

您好,谢恩。 感谢您使用Application Insights!

Hello, Shane.  Thank you for using Application Insights!

是的,您可以组合Application Insights资源创建并添加可用性测试(以及其他内容)。 您需要将可用性测试代码合并到Application Insights资源创建代码中:

Yes, you can combine the Application Insights resource creation and add an availability test (among other things).  You will need to merge the availability test code into the Application Insights resource creation code:


这个例子用于ping测试(测试单个页面)。

This example is for a ping test (to test a single page).


可用性中有两部分  ity测试:测试本身,以及通知你失败的警报。

There are two parts in an availability test: the test itself, and the alert that notifies you of failures.


将以下代码合并到创建应用程序的模板文件中。

Merge the following code into the template file that creates the app.


{
    parameters: { ... // existing parameters here ...
      "pingURL": { "type": "string" },
      "pingText": { "type": "string" , defaultValue: ""}
    },
    variables: { ... // existing variables here ...
      "pingTestName":"[concat('PingTest-', toLower(parameters('appName')))]",
      "pingAlertRuleName": "[concat('PingAlert-', toLower(parameters('appName')), '-', subscription().subscriptionId)]"
    },
    resources: { ... // existing resources here ...
    { //
      // Availability test: part 1 configures the test
      //
      "name": "[variables('pingTestName')]",
      "type": "Microsoft.Insights/webtests",
      "apiVersion": "2014-04-01",
      "location": "[parameters('appLocation')]",
      // Ensure this is created after the app resource:
      "dependsOn": [
        "[resourceId('Microsoft.Insights/components', parameters('appName'))]"
      ],
      "tags": {
        "[concat('hidden-link:', resourceId('Microsoft.Insights/components', parameters('appName')))]": "Resource"
      },
      "properties": {
        "Name": "[variables('pingTestName')]",
        "Description": "Basic ping test",
        "Enabled": true,
        "Frequency": 900, // 15 minutes
        "Timeout": 120, // 2 minutes
        "Kind": "ping", // single URL test
        "RetryEnabled": true,
        "Locations": [
          {
            "Id": "us-va-ash-azr"
          },
          {
            "Id": "emea-nl-ams-azr"
          },
          {
            "Id": "apac-jp-kaw-edge"
          }
        ],
        "Configuration": {
          "WebTest": "[concat('<WebTest   Name=\"', variables('pingTestName'), '\"   Enabled=\"True\"         CssProjectStructure=\"\"    CssIteration=\"\"  Timeout=\"120\"  WorkItemIds=\"\"         xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\"         Description=\"\"  CredentialUserName=\"\"  CredentialPassword=\"\"         PreAuthenticate=\"True\"  Proxy=\"default\"  StopOnError=\"False\"         RecordedResultFile=\"\"  ResultsLocale=\"\">  <Items>  <Request Method=\"GET\"    Version=\"1.1\"  Url=\"', parameters('Url'),   '\" ThinkTime=\"0\"  Timeout=\"300\" ParseDependentRequests=\"True\"         FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\"         ResponseTimeGoal=\"0\"  Encoding=\"utf-8\"  ExpectedHttpStatusCode=\"200\"         ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" />        </Items>  <ValidationRules> <ValidationRule  Classname=\"Microsoft.VisualStudio.TestTools.WebTesting.Rules.ValidationRuleFindText, Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" DisplayName=\"Find Text\"         Description=\"Verifies the existence of the specified text in the response.\"         Level=\"High\"  ExecutionOrder=\"BeforeDependents\">  <RuleParameters>        <RuleParameter Name=\"FindText\" Value=\"',   parameters('pingText'), '\" />  <RuleParameter Name=\"IgnoreCase\" Value=\"False\" />  <RuleParameter Name=\"UseRegularExpression\" Value=\"False\" />  <RuleParameter Name=\"PassIfTextFound\" Value=\"True\" />  </RuleParameters> </ValidationRule>  </ValidationRules>  </WebTest>')]"
        },
        "SyntheticMonitorId": "[variables('pingTestName')]"
      }
    },

    {
      //
      // Availability test: part 2, the alert rule
      //
      "name": "[variables('pingAlertRuleName')]",
      "type": "Microsoft.Insights/alertrules",
      "apiVersion": "2014-04-01",
      "location": "[parameters('appLocation')]", 
      "dependsOn": [
        "[resourceId('Microsoft.Insights/webtests', variables('pingTestName'))]"
      ],
      "tags": {
        "[concat('hidden-link:', resourceId('Microsoft.Insights/components', parameters('appName')))]": "Resource",
        "[concat('hidden-link:', resourceId('Microsoft.Insights/webtests', variables('pingTestName')))]": "Resource"
      },
      "properties": {
        "name": "[variables('pingAlertRuleName')]",
        "description": "alert for web 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.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('pingTestName'))]",
" metricName":" GSMT_AvRaW"
},
" windowSize":" PT15M",//如果状态改变15分钟,请采取措施
" failedLocationCount":2
},
"行动":[
{
"
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('pingTestName'))]", "metricName": "GSMT_AvRaW" }, "windowSize": "PT15M", // Take action if changed state for 15 minutes "failedLocationCount": 2 }, "actions": [ { "


这篇关于AI ARM Yemplate部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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