Skip to content

Commit

Permalink
Added AzureMonitor V1 task for querying new Azure Monitor Alerts.
Browse files Browse the repository at this point in the history
  • Loading branch information
vithati committed Jan 3, 2019
1 parent 990a2e9 commit 2473c46
Show file tree
Hide file tree
Showing 9 changed files with 318 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Tasks/AzureMonitorAlertsV0/* @kmkumaran

Tasks/AzureMonitorV0/* @bansalaseem

Tasks/AzureMonitorV1/* @vithati

Tasks/AzureMysqlDeploymentV1/* @kmkumaran @RoshanKumarMicrosoft

Tasks/AzureNLBManagementV1/* @kmkumaran
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"loc.friendlyName": "Query Azure Monitor Alerts",
"loc.friendlyName": "Query Classic Azure Monitor Alerts",
"loc.helpMarkDown": "[More Information](https://go.microsoft.com/fwlink/?linkid=870240)",
"loc.description": "Observe the configured Azure monitor rules for active alerts.",
"loc.description": "Observe the configured classic Azure monitor rules for active alerts.",
"loc.instanceNameFormat": "Query Azure Monitor alerts",
"loc.input.label.connectedServiceNameARM": "Azure subscription",
"loc.input.help.connectedServiceNameARM": "Select an Azure Resource Manager subscription to monitor.",
Expand Down
6 changes: 3 additions & 3 deletions Tasks/AzureMonitorV0/task.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"id": "99A72E7F-25E4-4576-BF38-22A42B995ED8",
"name": "AzureMonitor",
"friendlyName": "Query Azure Monitor Alerts",
"description": "Observe the configured Azure monitor rules for active alerts.",
"friendlyName": "Query Classic Azure Monitor Alerts",
"description": "Observe the configured classic Azure monitor rules for active alerts.",
"author": "Microsoft Corporation",
"helpMarkDown": "[More Information](https://go.microsoft.com/fwlink/?linkid=870240)",
"category": "Utility",
Expand All @@ -17,7 +17,7 @@
"version": {
"Major": 0,
"Minor": 0,
"Patch": 11
"Patch": 12
},
"instanceNameFormat": "Query Azure Monitor alerts",
"groups": [],
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzureMonitorV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"version": {
"Major": 0,
"Minor": 0,
"Patch": 11
"Patch": 12
},
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
"groups": [],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"loc.friendlyName": "Query Azure Monitor Alerts",
"loc.helpMarkDown": "[More Information](https://go.microsoft.com/fwlink/?linkid=870240)",
"loc.description": "Observe the configured Azure monitor rules for active alerts.",
"loc.instanceNameFormat": "Query Azure Monitor alerts",
"loc.group.displayName.advanced": "Advanced",
"loc.input.label.connectedServiceNameARM": "Azure subscription",
"loc.input.help.connectedServiceNameARM": "Select an Azure Resource Manager subscription to monitor.",
"loc.input.label.ResourceGroupName": "Resource group",
"loc.input.help.ResourceGroupName": "Provide the name of a resource group to monitor.",
"loc.input.label.resource": "Resource",
"loc.input.help.resource": "Select Azure resource to monitor.",
"loc.input.label.severity ": "Severity ",
"loc.input.help.severity ": "Filter by severity. Default value is select all.",
"loc.input.label.timeRange": "Time range",
"loc.input.help.timeRange": "Filter by time range. Default value is 1 hour.",
"loc.input.label.alertState": "Alert state",
"loc.input.help.alertState": "Filter by state of the alert instance. Default value is to select all."
}
Binary file added Tasks/AzureMonitorV1/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
145 changes: 145 additions & 0 deletions Tasks/AzureMonitorV1/task.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{
"id": "99A72E7F-25E4-4576-BF38-22A42B995ED8",
"name": "AzureMonitor",
"friendlyName": "Query Azure Monitor Alerts",
"description": "Observe the configured Azure monitor rules for active alerts.",
"author": "Microsoft Corporation",
"helpMarkDown": "[More Information](https://go.microsoft.com/fwlink/?linkid=870240)",
"category": "Utility",
"visibility": [
"Build",
"Release"
],
"runsOn": [
"Server",
"ServerGate"
],
"version": {
"Major": 1,
"Minor": 0,
"Patch": 0
},
"instanceNameFormat": "Query Azure Monitor alerts",
"groups": [
{
"name": "advanced",
"displayName": "Advanced",
"isExpanded": false
}
],
"inputs": [
{
"name": "connectedServiceNameARM",
"type": "connectedService:AzureRM",
"label": "Azure subscription",
"defaultValue": "",
"required": "true",
"helpMarkDown": "Select an Azure Resource Manager subscription to monitor."
},
{
"name": "ResourceGroupName",
"type": "pickList",
"label": "Resource group",
"required": true,
"properties": {
"EditableOptions": "True"
},
"helpMarkDown": "Provide the name of a resource group to monitor."
},
{
"name": "resource",
"type": "pickList",
"label": "Resource",
"required": false,
"properties": {
"MultiSelectFlatList": "True"
},
"helpMarkDown": "Select Azure resource to monitor."
},
{
"name": "severity ",
"type": "pickList",
"label": "Severity ",
"required": false,
"defaultValue": "Sev0,Sev1,Sev2,Sev3,Sev4",
"options": {
"Sev0": "Sev0",
"Sev1": "Sev1",
"Sev2": "Sev2",
"Sev3": "Sev3",
"Sev4": "Sev4"
},
"properties": {
"MultiSelectFlatList": "True",
"EditableOptions": "True"
},
"helpMarkDown": "Filter by severity. Default value is select all.",
"groupName": "advanced"
},
{
"name": "timeRange",
"type": "pickList",
"label": "Time range",
"required": false,
"defaultValue": "1h",
"options": {
"1h": "Past hour",
"1d": "Past 24 hours",
"7d": "Past 7 days",
"30d": "Past 30 days"
},
"properties": {
"EditableOptions": "false"
},
"helpMarkDown": "Filter by time range. Default value is 1 hour.",
"groupName": "advanced"
},
{
"name": "alertState",
"type": "pickList",
"label": "Alert state",
"required": false,
"defaultValue": "Acknowledged,Closed,New",
"options": {
"New": "New",
"Acknowledged": "Acknowledged",
"Closed": "Closed"
},
"properties": {
"MultiSelectFlatList": "True",
"EditableOptions": "True"
},
"helpMarkDown": "Filter by state of the alert instance. Default value is to select all.",
"groupName": "advanced"
}
],
"dataSourceBindings": [
{
"target": "ResourceGroupName",
"endpointId": "$(connectedServiceNameARM)",
"dataSourceName": "AzureResourceGroups"
},
{
"target": "resource",
"endpointId": "$(connectedServiceNameARM)",
"dataSourceName": "AzureRMResourcesInRG",
"parameters": {
"ResourceGroupName": "$(ResourceGroupName)"
},
"resultTemplate": "{ \"Value\" : \"{{{type}}}/{{{name}}}\", \"DisplayValue\" : \"{{{name}}} [{{{type}}}]\" }"
}
],
"execution": {
"HttpRequest": {
"Execute": {
"EndpointId": "$(connectedServiceNameARM)",
"EndpointUrl": "$(endpoint.url)/subscriptions/{{subscriptionId}}/providers/Microsoft.AlertsManagement/alerts?api-version=2018-05-05&monitorCondition=Fired&targetResourceGroup={{ResourceGroupName}}&timeRange={{timeRange}}&alertState={{alertState}}&severity={{severity}}{{#if resource}}&targetResource={{#splitAndIterate ',' resource}}/subscriptions/{{#..}}{{subscriptionId}}{{/..}}/resourcegroups/{{#..}}{{ResourceGroupName}}{{/..}}/providers/{{this}},{{/splitAndIterate}}{{/if}}",
"Method": "GET",
"Body": "",
"Headers": "",
"WaitForCompletion": "false",
"Expression": "eq(count(jsonpath('$.value[*]')), 0)"
}
}
}
}
145 changes: 145 additions & 0 deletions Tasks/AzureMonitorV1/task.loc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{
"id": "99A72E7F-25E4-4576-BF38-22A42B995ED8",
"name": "AzureMonitor",
"friendlyName": "ms-resource:loc.friendlyName",
"description": "ms-resource:loc.description",
"author": "Microsoft Corporation",
"helpMarkDown": "ms-resource:loc.helpMarkDown",
"category": "Utility",
"visibility": [
"Build",
"Release"
],
"runsOn": [
"Server",
"ServerGate"
],
"version": {
"Major": 1,
"Minor": 0,
"Patch": 0
},
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
"groups": [
{
"name": "advanced",
"displayName": "ms-resource:loc.group.displayName.advanced",
"isExpanded": false
}
],
"inputs": [
{
"name": "connectedServiceNameARM",
"type": "connectedService:AzureRM",
"label": "ms-resource:loc.input.label.connectedServiceNameARM",
"defaultValue": "",
"required": "true",
"helpMarkDown": "ms-resource:loc.input.help.connectedServiceNameARM"
},
{
"name": "ResourceGroupName",
"type": "pickList",
"label": "ms-resource:loc.input.label.ResourceGroupName",
"required": true,
"properties": {
"EditableOptions": "True"
},
"helpMarkDown": "ms-resource:loc.input.help.ResourceGroupName"
},
{
"name": "resource",
"type": "pickList",
"label": "ms-resource:loc.input.label.resource",
"required": false,
"properties": {
"MultiSelectFlatList": "True"
},
"helpMarkDown": "ms-resource:loc.input.help.resource"
},
{
"name": "severity ",
"type": "pickList",
"label": "ms-resource:loc.input.label.severity ",
"required": false,
"defaultValue": "Sev0,Sev1,Sev2,Sev3,Sev4",
"options": {
"Sev0": "Sev0",
"Sev1": "Sev1",
"Sev2": "Sev2",
"Sev3": "Sev3",
"Sev4": "Sev4"
},
"properties": {
"MultiSelectFlatList": "True",
"EditableOptions": "True"
},
"helpMarkDown": "ms-resource:loc.input.help.severity ",
"groupName": "advanced"
},
{
"name": "timeRange",
"type": "pickList",
"label": "ms-resource:loc.input.label.timeRange",
"required": false,
"defaultValue": "1h",
"options": {
"1h": "Past hour",
"1d": "Past 24 hours",
"7d": "Past 7 days",
"30d": "Past 30 days"
},
"properties": {
"EditableOptions": "false"
},
"helpMarkDown": "ms-resource:loc.input.help.timeRange",
"groupName": "advanced"
},
{
"name": "alertState",
"type": "pickList",
"label": "ms-resource:loc.input.label.alertState",
"required": false,
"defaultValue": "Acknowledged,Closed,New",
"options": {
"New": "New",
"Acknowledged": "Acknowledged",
"Closed": "Closed"
},
"properties": {
"MultiSelectFlatList": "True",
"EditableOptions": "True"
},
"helpMarkDown": "ms-resource:loc.input.help.alertState",
"groupName": "advanced"
}
],
"dataSourceBindings": [
{
"target": "ResourceGroupName",
"endpointId": "$(connectedServiceNameARM)",
"dataSourceName": "AzureResourceGroups"
},
{
"target": "resource",
"endpointId": "$(connectedServiceNameARM)",
"dataSourceName": "AzureRMResourcesInRG",
"parameters": {
"ResourceGroupName": "$(ResourceGroupName)"
},
"resultTemplate": "{ \"Value\" : \"{{{type}}}/{{{name}}}\", \"DisplayValue\" : \"{{{name}}} [{{{type}}}]\" }"
}
],
"execution": {
"HttpRequest": {
"Execute": {
"EndpointId": "$(connectedServiceNameARM)",
"EndpointUrl": "$(endpoint.url)/subscriptions/{{subscriptionId}}/providers/Microsoft.AlertsManagement/alerts?api-version=2018-05-05&monitorCondition=Fired&targetResourceGroup={{ResourceGroupName}}&timeRange={{timeRange}}&alertState={{alertState}}&severity={{severity}}{{#if resource}}&targetResource={{#splitAndIterate ',' resource}}/subscriptions/{{#..}}{{subscriptionId}}{{/..}}/resourcegroups/{{#..}}{{ResourceGroupName}}{{/..}}/providers/{{this}},{{/splitAndIterate}}{{/if}}",
"Method": "GET",
"Body": "",
"Headers": "",
"WaitForCompletion": "false",
"Expression": "eq(count(jsonpath('$.value[*]')), 0)"
}
}
}
}
1 change: 1 addition & 0 deletions make-options.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"AzureKeyVaultV1",
"AzureMonitorAlertsV0",
"AzureMonitorV0",
"AzureMonitorV1",
"AzureMysqlDeploymentV1",
"AzureNLBManagementV1",
"AzurePolicyV0",
Expand Down

0 comments on commit 2473c46

Please sign in to comment.