Skip to content

Commit 4b4daa4

Browse files
committed
update metric alert section
1 parent ff33c22 commit 4b4daa4

File tree

1 file changed

+1
-69
lines changed

1 file changed

+1
-69
lines changed

articles/azure-monitor/app/powershell.md

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -357,75 +357,7 @@ You can also set the pricing plan on an existing Application Insights resource u
357357

358358
## Add a metric alert
359359

360-
To set up a metric alert at the same time as your app resource, merge code like this into the template file:
361-
362-
```JSON
363-
{
364-
parameters: { ... // existing parameters ...
365-
"responseTime": {
366-
"type": "int",
367-
"defaultValue": 3,
368-
"minValue": 1,
369-
"metadata": {
370-
"description": "Enter response time threshold in seconds."
371-
}
372-
},
373-
variables: { ... // existing variables ...
374-
// Alert names must be unique within resource group.
375-
"responseAlertName": "[concat('ResponseTime-', toLower(parameters('appName')))]"
376-
},
377-
resources: { ... // existing resources ...
378-
{
379-
//
380-
// Metric alert on response time
381-
//
382-
"name": "[variables('responseAlertName')]",
383-
"type": "Microsoft.Insights/alertrules",
384-
"apiVersion": "2014-04-01",
385-
"location": "[parameters('appLocation')]",
386-
// Ensure this resource is created after the app resource:
387-
"dependsOn": [
388-
"[resourceId('Microsoft.Insights/components', parameters('appName'))]"
389-
],
390-
"tags": {
391-
"[concat('hidden-link:', resourceId('Microsoft.Insights/components', parameters('appName')))]": "Resource"
392-
},
393-
"properties": {
394-
"name": "[variables('responseAlertName')]",
395-
"description": "response time alert",
396-
"isEnabled": true,
397-
"condition": {
398-
"$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition, Microsoft.WindowsAzure.Management.Mon.Client",
399-
"odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
400-
"dataSource": {
401-
"$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, Microsoft.WindowsAzure.Management.Mon.Client",
402-
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
403-
"resourceUri": "[resourceId('microsoft.insights/components', parameters('appName'))]",
404-
"metricName": "request.duration"
405-
},
406-
"threshold": "[parameters('responseTime')]", //seconds
407-
"windowSize": "PT15M" // Take action if changed state for 15 minutes
408-
},
409-
"actions": [
410-
{
411-
"$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, Microsoft.WindowsAzure.Management.Mon.Client",
412-
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction",
413-
"sendToServiceOwners": true,
414-
"customEmails": []
415-
}
416-
]
417-
}
418-
}
419-
}
420-
```
421-
422-
When you invoke the template, you can optionally add this parameter:
423-
424-
`-responseTime 2`
425-
426-
You can of course parameterize other fields.
427-
428-
To find out the type names and configuration details of other alert rules, create a rule manually and then inspect it in [Azure Resource Manager](https://resources.azure.com/).
360+
To automate the creation of metric alerts consult the [metric alerts template article](https://docs.microsoft.com/azure/azure-monitor/platform/alerts-metric-create-templates#template-for-a-simple-static-threshold-metric-alert)
429361

430362

431363
## Add an availability test

0 commit comments

Comments
 (0)