Skip to content

Commit

Permalink
Update Azure Monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
ericzhao0821 committed Aug 3, 2019
1 parent 130151c commit 0011a14
Show file tree
Hide file tree
Showing 72 changed files with 1,434 additions and 219 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
03.Azure资料合集/动手实验/CloudGovernance/Handson_Monitor_Locally.md
447 changes: 251 additions & 196 deletions 03.Azure资料合集/动手实验/CloudGovernance/Handson_Monitor.md

Large diffs are not rendered by default.

Binary file not shown.
Expand Up @@ -26,6 +26,15 @@
"metadata": {
"description": "Specifies the service tier of the workspace: Standalone, PerNode, Per-GB"
}
},
"dataRetention": {
"type": "int",
"defaultValue": 30,
"minValue": 7,
"maxValue": 730,
"metadata": {
"description": "Number of days of retention. Workspaces in the legacy Free pricing tier can only have 7 days."
}
}
},
"resources": [
Expand All @@ -40,7 +49,8 @@
},
"features": {
"searchVersion": 1
}
},
"retentionInDays": "[parameters('dataRetention')]"
}
}
]
Expand Down
@@ -0,0 +1,105 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"activityLogAlertName": {
"type": "string",
"metadata": {
"description": "Unique name (within the Resource Group) for the Activity log alert."
}
},
"actionGroupResourceId": {
"type": "string",
"metadata": {
"description": "Resource Id for the Action group."
}
},
"scopes":{
"type": "array",
"minLength": 1,
"metadata": {
"description": "Resource Health Monitor is for subscription or resource group or specific resource."
}
}
},
"resources": [
{
"type": "Microsoft.Insights/activityLogAlerts",
"apiVersion": "2017-04-01",
"name": "[parameters('activityLogAlertName')]",
"location": "Global",
"properties": {
"enabled": true,
"scopes": "[parameters('scopes')]",
"condition": {
"allOf": [
{
"field": "category",
"equals": "ResourceHealth",
"containsAny": null
},
{
"anyOf": [
{
"field": "properties.currentHealthStatus",
"equals": "Unavailable",
"containsAny": null
},
{
"field": "properties.currentHealthStatus",
"equals": "Degraded",
"containsAny": null
},
{
"field": "properties.currentHealthStatus",
"equals": "Unknown",
"containsAny": null
}
]
},
{
"anyOf": [
{
"field": "properties.previousHealthStatus",
"equals": "Available",
"containsAny": null
}
]
},
{
"anyOf": [
{
"field": "status",
"equals": "Active",
"containsAny": null
},
{
"field": "status",
"equals": "Resolved",
"containsAny": null
},
{
"field": "status",
"equals": "InProgress",
"containsAny": null
},
{
"field": "status",
"equals": "Updated",
"containsAny": null
}
]
}
]
},
"actions": {
"actionGroups": [
{
"actionGroupId": "[parameters('actionGroupResourceId')]"
}
]
}
}
}
]
}
@@ -0,0 +1,211 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"alertName": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "Name of the alert"
}
},
"alertDescription": {
"type": "string",
"defaultValue": "This is a metric alert",
"metadata": {
"description": "Description of alert"
}
},
"alertSeverity": {
"type": "int",
"defaultValue": 3,
"allowedValues": [
0,
1,
2,
3,
4
],
"metadata": {
"description": "Severity of alert {0,1,2,3,4}"
}
},
"isEnabled": {
"type": "bool",
"defaultValue": true,
"metadata": {
"description": "Specifies whether the alert is enabled"
}
},
"targetResourceGroup":{
"type": "array",
"minLength": 1,
"metadata": {
"description": "Full path of the resource group(s) where target resources to be monitored are in. For example - /subscriptions/00000000-0000-0000-0000-0000-00000000/resourceGroups/ResourceGroupName"
}
},
"targetResourceRegion":{
"type": "string",
"allowedValues": [
"EastUS",
"EastUS2",
"CentralUS",
"NorthCentralUS",
"SouthCentralUS",
"WestCentralUS",
"WestUS",
"WestUS2",
"CanadaEast",
"CanadaCentral",
"BrazilSouth",
"NorthEurope",
"WestEurope",
"FranceCentral",
"FranceSouth",
"UKWest",
"UKSouth",
"GermanyCentral",
"GermanyNortheast",
"GermanyNorth",
"GermanyWestCentral",
"SwitzerlandNorth",
"SwitzerlandWest",
"NorwayEast",
"NorwayWest",
"SoutheastAsia",
"EastAsia",
"AustraliaEast",
"AustraliaSoutheast",
"AustraliaCentral",
"AustraliaCentral2",
"ChinaEast",
"ChinaNorth",
"ChinaEast2",
"ChinaNorth2",
"CentralIndia",
"WestIndia",
"SouthIndia",
"JapanEast",
"JapanWest",
"KoreaCentral",
"KoreaSouth",
"SouthAfricaWest",
"SouthAfricaNorth",
"UAECentral",
"UAENorth"
],
"metadata": {
"description": "Azure region in which target resources to be monitored are in (without spaces). For example: EastUS"
}
},
"targetResourceType": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "Resource type of target resources to be monitored. Currently only supported resource type is Microsoft.Compute/virtualMachines"
}
},
"metricName": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "Name of the metric used in the comparison to activate the alert."
}
},
"operator": {
"type": "string",
"defaultValue": "GreaterThan",
"allowedValues": [
"Equals",
"NotEquals",
"GreaterThan",
"GreaterThanOrEqual",
"LessThan",
"LessThanOrEqual"
],
"metadata": {
"description": "Operator comparing the current value with the threshold value."
}
},
"threshold": {
"type": "string",
"defaultValue": "0",
"metadata": {
"description": "The threshold value at which the alert is activated."
}
},
"timeAggregation": {
"type": "string",
"defaultValue": "Average",
"allowedValues": [
"Average",
"Minimum",
"Maximum",
"Total",
"Count"
],
"metadata": {
"description": "How the data that is collected should be combined over time."
}
},
"windowSize": {
"type": "string",
"defaultValue": "PT5M",
"metadata": {
"description": "Period of time used to monitor alert activity based on the threshold. Must be between five minutes and one day. ISO 8601 duration format."
}
},
"evaluationFrequency": {
"type": "string",
"defaultValue": "PT1M",
"metadata": {
"description": "how often the metric alert is evaluated represented in ISO 8601 duration format"
}
},
"actionGroupId": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "The ID of the action group that is triggered when the alert is activated or deactivated"
}
}
},
"variables": { },
"resources": [
{
"name": "[parameters('alertName')]",
"type": "Microsoft.Insights/metricAlerts",
"location": "global",
"apiVersion": "2018-03-01",
"tags": {},
"properties": {
"description": "[parameters('alertDescription')]",
"severity": "[parameters('alertSeverity')]",
"enabled": "[parameters('isEnabled')]",
"scopes": "[parameters('targetResourceGroup')]",
"targetResourceType": "[parameters('targetResourceType')]",
"targetResourceRegion": "[parameters('targetResourceRegion')]",
"evaluationFrequency":"[parameters('evaluationFrequency')]",
"windowSize": "[parameters('windowSize')]",
"criteria": {
"odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
"allOf": [
{
"name" : "1st criterion",
"metricName": "[parameters('metricName')]",
"dimensions":[],
"operator": "[parameters('operator')]",
"threshold" : "[parameters('threshold')]",
"timeAggregation": "[parameters('timeAggregation')]"
}
]
},
"actions": [
{
"actionGroupId": "[parameters('actionGroupId')]"
}
]
}
}
]
}
@@ -0,0 +1,42 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"alertName": {
"value": "VM CPU is higher"
},
"alertDescription": {
"value": "Need take action when VM CPU is higher"
},
"alertSeverity": {
"value":2
},
"isEnabled": {
"value": true
},
"targetResourceGroup":{
"value": []
},
"targetResourceRegion":{
"value": "EastUS"
},
"targetResourceType":{
"value": "Microsoft.Compute/virtualMachines"
},
"metricName": {
"value": "Percentage CPU"
},
"operator": {
"value": "GreaterThan"
},
"threshold": {
"value": "75"
},
"timeAggregation": {
"value": "Average"
},
"actionGroupId": {
"value": ""
}
}
}

0 comments on commit 0011a14

Please sign in to comment.