Skip to content

Commit 3cad037

Browse files
committed
update doc per github issue feedback
1 parent 9c19588 commit 3cad037

File tree

1 file changed

+1
-102
lines changed

1 file changed

+1
-102
lines changed

articles/azure-monitor/app/powershell.md

Lines changed: 1 addition & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -430,108 +430,7 @@ To find out the type names and configuration details of other alert rules, creat
430430

431431
## Add an availability test
432432

433-
This example is for a ping test (to test a single page).
434-
435-
**There are two parts** in an availability test: the test itself, and the alert that notifies you of failures.
436-
437-
Merge the following code into the template file that creates the app.
438-
439-
```JSON
440-
{
441-
parameters: { ... // existing parameters here ...
442-
"pingURL": { "type": "string" },
443-
"pingText": { "type": "string" , defaultValue: ""}
444-
},
445-
variables: { ... // existing variables here ...
446-
"pingTestName":"[concat('PingTest-', toLower(parameters('appName')))]",
447-
"pingAlertRuleName": "[concat('PingAlert-', toLower(parameters('appName')), '-', subscription().subscriptionId)]"
448-
},
449-
resources: { ... // existing resources here ...
450-
{ //
451-
// Availability test: part 1 configures the test
452-
//
453-
"name": "[variables('pingTestName')]",
454-
"type": "Microsoft.Insights/webtests",
455-
"apiVersion": "2014-04-01",
456-
"location": "[parameters('appLocation')]",
457-
// Ensure this is created after the app resource:
458-
"dependsOn": [
459-
"[resourceId('Microsoft.Insights/components', parameters('appName'))]"
460-
],
461-
"tags": {
462-
"[concat('hidden-link:', resourceId('Microsoft.Insights/components', parameters('appName')))]": "Resource"
463-
},
464-
"properties": {
465-
"Name": "[variables('pingTestName')]",
466-
"Description": "Basic ping test",
467-
"Enabled": true,
468-
"Frequency": 900, // 15 minutes
469-
"Timeout": 120, // 2 minutes
470-
"Kind": "ping", // single URL test
471-
"RetryEnabled": true,
472-
"Locations": [
473-
{
474-
"Id": "us-va-ash-azr"
475-
},
476-
{
477-
"Id": "emea-nl-ams-azr"
478-
},
479-
{
480-
"Id": "apac-jp-kaw-edge"
481-
}
482-
],
483-
"Configuration": {
484-
"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>')]"
485-
},
486-
"SyntheticMonitorId": "[variables('pingTestName')]"
487-
}
488-
},
489-
490-
{
491-
//
492-
// Availability test: part 2, the alert rule
493-
//
494-
"name": "[variables('pingAlertRuleName')]",
495-
"type": "Microsoft.Insights/alertrules",
496-
"apiVersion": "2014-04-01",
497-
"location": "[parameters('appLocation')]",
498-
"dependsOn": [
499-
"[resourceId('Microsoft.Insights/webtests', variables('pingTestName'))]"
500-
],
501-
"tags": {
502-
"[concat('hidden-link:', resourceId('Microsoft.Insights/components', parameters('appName')))]": "Resource",
503-
"[concat('hidden-link:', resourceId('Microsoft.Insights/webtests', variables('pingTestName')))]": "Resource"
504-
},
505-
"properties": {
506-
"name": "[variables('pingAlertRuleName')]",
507-
"description": "alert for web test",
508-
"isEnabled": true,
509-
"condition": {
510-
"$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.LocationThresholdRuleCondition, Microsoft.WindowsAzure.Management.Mon.Client",
511-
"odata.type": "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition",
512-
"dataSource": {
513-
"$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, Microsoft.WindowsAzure.Management.Mon.Client",
514-
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
515-
"resourceUri": "[resourceId('microsoft.insights/webtests', variables('pingTestName'))]",
516-
"metricName": "GSMT_AvRaW"
517-
},
518-
"windowSize": "PT15M", // Take action if changed state for 15 minutes
519-
"failedLocationCount": 2
520-
},
521-
"actions": [
522-
{
523-
"$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, Microsoft.WindowsAzure.Management.Mon.Client",
524-
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction",
525-
"sendToServiceOwners": true,
526-
"customEmails": []
527-
}
528-
]
529-
}
530-
}
531-
}
532-
```
533-
534-
To discover the codes for other test locations, or to automate the creation of more complex web tests, create an example manually and then parameterize the code from [Azure Resource Manager](https://resources.azure.com/).
433+
To automate availability tests consult the [metric alerts template article](https://docs.microsoft.com/azure/azure-monitor/platform/alerts-metric-create-templates#template-for-a-availability-test-along-with-availability-test-alert).
535434

536435
## Add more resources
537436

0 commit comments

Comments
 (0)