New-CmAzMonitorMetricAlerts

Allows definiton and deployment of metric alerts for resources/resource groups to set action groups.

Deploys multi-resource single-metric alert rules at either a resource group or resource scope, which in turn are linked to specified action groups. The metric name is used to specify the metric rule used, all rules specified can have a customisable threshold, comparison operator, time aggregation, severity and schedule values. Metric alerts are only available if the resources/resources groups specified in the scope share the same location.

This command forms part of the Monitor Building Block.

Parameters

-SettingsFile

Required. (String) File path for the settings file to be converted into a settings object.

-SettingsObject

Required. (Object) Object containing the configuration values required to run this cmdlet.

-WhatIf

(Switch) Run the command without executing any actions, so that no changes are made. The command will output a description of actions to be performed against the affected resources in the console window. Use this option if you are unsure of the overall impact of your command and wish to review it before committing to making changes.

-Confirm

(Switch) Run the command without executing any actions, so that no changes are made. The command will output a description of actions to be performed against the affected resources in the console window. Use this option if you are unsure of the overall impact of your command and wish to review it before committing to making changes.

Usage

Example 1

1
New-CmAzMonitorMetricAlerts -SettingsFile "c:\directory\settingsFile.yml"

Example 2

1
New-CmAzMonitorMetricAlerts -SettingsObject $settings

Settings

Beta documentation
The following schema documentation is automatically generated as part of a recent roadmap task. There may be inaccuracies or incomplete information while we flush out bugs; please refer to the packed project settings examples where necessary.

Settings Root.

Component

component [string | null] Mandatory

Value to determine what cmdlet should be dynamically loaded for these settings.

Service

service [object]

Contains dependency and publish details for service location.

Dependencies

dependencies [object]

Contains dependency details for service location.

Action Groups

actionGroups [array | null]

Global default dependency value to fetch existing resource type.

ResourceGroup

resourceGroup [string]

Dependency value to fetch existing resource type.

Publish

publish [object | null]

Contains publish details for service location.

Metric Alert

metricAlert [string | null]

Global default value to publish on deployed resource type.

Groups

groups [array] Mandatory

Contains all details pertaining to logical groupings of alert sets.

Name

name [string]

The name of the grouping.

Alert Sets

alertSets [array]

Contains all alert set details for a specific grouping.

Resource Type

resourceType [string]

The resource Type as defined in the Azure namespace.

Name

name []

Becomes part of metric alert rule generated name.

Alerts

alerts [array]

Contains all details of the metric alert rules to be deployed.

Name

name []

Becomes part of log alert rule generated name.

Metric Name

metricName []

The name of the metric alert rule.

Description

description [string | null]

Description of the metric alert rule.

TargetResourceLocation

targetResourceLocation [string]

Location of the resources that the alert rule is set to.

Threshold

threshold [object]

Contains threshold details for the metric alert rule.

Operator

operator [string]

The value comparison operator.

Valid values:"Equals" , "NotEquals" , "GreaterThan" , "GreaterThanOrEqual" , "LessThan" , "LessThanOrEqual"

Value

value [integer]

The threshold value that triggers the alert.

Time Aggregation

timeAggregation [string]

The type of aggregation to apply to the monitored data.

Valid values:"Average" , "Maximum" , "Minimum" , "Total" , "Count"

Enabled

enabled [boolean | null]

If the alert rule is enabled or not.

Default:true

Severity

severity [string | null]

The severity level of the alert to trigger.

Valid values:"Critical" , "Error" , "Warning" , "Informational" , "Verbose"

Schedule

schedule [object | null]

Container of metric alert rule schedule details.

Frequency In Minutes

frequencyInMinutes [integer]

The frequency in which the metric alert rule is run.

Valid values:"1" , "2" , "15" , "30" , "60"

Time Window In Minutes

aggregationGranulat [integer]

The interval over which the data is grouped according to the selected aggregation type.

Valid values:"1" , "5" , "15" , "30" , "60" , "360" , "720" , "1440"

Service

service [object]

Contains dependency and publish details for service location.

Dependencies

dependencies [object]

Contains dependency details for service location.

Action Groups

actionGroups [array | null]

Local overriding dependency value to fetch existing resource type.

TargetResources

targetResources [array | null]

Service tag value to fetch existing resources of which to apply the metric alert rule.

TargetResourceGroups

targetResourceGroups [array | null]

Service tag value to fetch existing resource groups of which to apply the metric alert rule.

Examples

The following example files are automatically generated from the settings file schema definition to show how the specification can be used in practise. Cloudmarque can accept both JSON and YAML parameter files.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{
  "component": "string",
  "service": {
    "dependencies": {
      "actionGroups": [

      ],
      "resourceGroup": "string"
    },
    "publish": {
      "metricAlert": "string"
    }
  },
  "groups": [
    {
      "name": "string",
      "alertSets": [
        {
          "resourceType": "string",
          "name": "unknown",
          "alerts": [
            {
              "name": "unknown",
              "metricName": "unknown",
              "description": "string",
              "targetResourceLocation": "string",
              "threshold": {
                "operator": "Equals",
                "value": 0,
                "timeAggregation": "Average"
              },
              "enabled": "true",
              "severity": "Critical",
              "schedule": {
                "frequencyInMinutes": 0,
                "aggregationGranulat": 0
              },
              "service": {
                "dependencies": {
                  "actionGroups": [

                  ],
                  "targetResources": [

                  ],
                  "targetResourceGroups": [

                  ]
                }
              }
            }
          ]
        }
      ]
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
component: "string"    # Mandatory
service:     # Optional
  dependencies:     # Optional
    actionGroups:     # Optional
      -     resourceGroup: "string"    # Mandatory
  publish:     # Optional
    metricAlert: "string"    # Optional
groups:     # Mandatory
  - name: "string"    # Mandatory
    alertSets:     # Mandatory
      - resourceType: "string"    # Mandatory
        name: "unknown"    # Optional
        alerts:     # Mandatory
          - name: "unknown"    # Optional
            metricName: "unknown"    # Optional
            description: "string"    # Optional
            targetResourceLocation: "string"    # Optional
            threshold:     # Optional
              operator: "Equals"    # Mandatory
              value: 0    # Mandatory
              timeAggregation: "Average"    # Mandatory
            enabled: "true"    # Optional
            severity: "Critical"    # Optional
            schedule:     # Optional
              frequencyInMinutes: 0    # Mandatory
              aggregationGranulat: 0    # Optional
            service:     # Optional
              dependencies:     # Optional
                actionGroups:     # Optional
                  -                 targetResources:     # Optional
                  -                 targetResourceGroups:     # Optional
                  -