Get Alert Rule

 

The Get Alert Rule operation retrieves information about the specified alert rule.

Request

The Get Alert Rule request may be specified as follows. Replace <subscription-id> with the subscription ID, <rule-id> with the identifier of the alert rule. You can obtain the identifier of an alert rule by using List Alert Rules.

Method

Request URI

GET

https://management.core.windows.net/<subscription-id>/services/monitoring/alertrules/<rule-id> HYPERLINK "https://monitoring.management.core.windows.net/%3csubscription-id%3e/services/monitoring/alert/rules"

You must make sure that the request that is made to the management service is secure. For additional details, see Authenticating Service Management Requests.

URI Parameters

None.

Request Headers

The following table describes the request headers.

Request Header

Description

Accept

Required. Set this header to application/json.

x-ms-version

Required. Specifies the version of the operation to use for this request. This header must be set to 2013-10-01 or higher. For more information about versioning headers, see Service Management Versioning.

Request Body

None.

Response

The response includes an HTTP status code, a set of response headers, and a response body.

Status Code

A successful operation returns status code 200 (OK). For information about status codes, see Service Management Status and Error Codes.

Response Headers

The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.

Response Header

Description

x-ms-request-id

A value that uniquely identifies a request made against the management service.

Response Body

The format of the response body is as follows:

{
  "Rule": [
    {   
      "Condition": {
        "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition",
        "DataSource": {
          "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource",
          "ResourceId": "<url-of-resource>",
          "MetricNamespace": "<namespace-of-metric>",
          "MetricName": "<name-of-metric>",
        },
        "Operator": "<operator-of-condition>",
        "Threshold": "<threshold-value>",
        "WindowSize": "<evaluation-time>",
      },
      "Actions": [
        {
          "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction",
          "SendToServiceOwners": "<send-to-owners>",
          "CustomEmails": [
            "<email-address>" 
          ] 
        }
      ], 
      "Id": "<identifier-of-alert-rule>",
      "Name": "<name-of-alert-rule>",
      "Description": "<description-of-alert-rule",
      "IsEnabled": "<status-of-alert-rule>",
    } 
  ]
}

The following table describes the elements of the response body.

Element Name

Description

Rule

Contains the elements that define an alert rule.

Condition

Specifies the conditional parameters for an alert rule.

Actions

Specifies the action that is performed when the alert rule becomes active, and when an alert condition is resolved.

Id

Specifies the identifier for the alert rule.

Name

Specifies the name of the alert rule.

Description

Specifies the description of the alert rule.

IsEnabled

Indicates whether the alert rule is enabled.

Possible values are:

  • true

  • false

Condition

Specifies the conditional parameters for an alert rule.

Element Name

Description

DataSource

Specifies information about the resource on which the alert is configured.

Operator

Specifies the operator of the condition.

Possible values are:

  • GreaterThan

  • GreaterThanOrEqual

  • LessThan

  • LessThanOrEqual

Threshold

Specifies the threshold value that triggers the alert.

WindowSize

Specifies the period of time that is used to monitor alert activity based on the threshold.

Possible values for Cloud Services and Virtual Machines when using host and guest level metrics are:

  • 5 mins

  • 10 mins

  • 15 mins

  • 30 mins

  • 45 mins

  • 60 mins

Possible values for all services when using availability metrics are:

  • 15 mins

  • 30 mins

  • 45 mins

  • 60 mins

For a description of host, guest, and availability level metrics, see the MetricName element.

Actions

Specifies the action that is performed when the alert rule becomes active, and when an alert condition is resolved.

Element Name

Description

SendToServiceOwners

Indicates whether the owners of the service should be notified when the alert is registered.

Possible values are:

  • true

  • false

CustomEmails

Specifies a list of email addresses to use for notification of the registration of an alert.

DataSource

Specifies information about the resource on which the alert is configured.

Element Name

Description

ResourceId

Specifies the relative URI of the resource to which the alert is associated.

Possible values are:

  • /hostedservices/<cloud-service-name>/deployments/<deployment-name>/roles/<role-name>

  • /webspaces/<webspace-name>/sites/<website-name>

  • /mobileservices/<mobile-service-name>

MetricNamespace

Specifies the namespace of the metric.

MetricName

Required. Specifies the name of the metric that defines what the alert rule monitors.

Remarks

You can also use the classic portal to see the alert rules that are defined. For more information, see How to: Receive Alert Notifications and Manage Alert Rules in Azure.