Skip to content

Commit 5d46b6f

Browse files
Merge pull request #235086 from AbbyMSFT/custom-properties
Add custom properties to alert payload
2 parents bbc8a2f + 388cdf4 commit 5d46b6f

File tree

6 files changed

+62
-49
lines changed

6 files changed

+62
-49
lines changed

articles/azure-monitor/alerts/alerts-common-schema.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ms.author: abbyweisberg
1212

1313
The common alert schema standardizes the consumption of Azure Monitor alert notifications. Historically, activity log, metric, and log alerts each had their own email templates and webhook schemas. The common alert schema provides one standardized schema for all alert notifications.
1414

15-
A standardized schema can help you minimize the number of integrations, which simplifies the process of managing and maintaining your integrations.
15+
Using a standardized schema helps minimize the number of integrations, which simplifies the process of managing and maintaining your integrations. The common schema enables a richer alert consumption experience in both the Azure portal and the Azure mobile app.
1616

1717
The common alert schema provides a consistent structure for:
1818
- **Email templates**: Use the detailed email template to diagnose issues at a glance. Embedded links to the alert instance on the portal and to the affected resource ensure that you can quickly jump into the remediation process.
@@ -21,8 +21,6 @@ The common alert schema provides a consistent structure for:
2121
- Azure Functions
2222
- Azure Automation runbook
2323

24-
The new schema enables a richer alert consumption experience in both the Azure portal and the Azure mobile app.
25-
2624
> [!NOTE]
2725
> Alerts generated by [VM insights](../vm/vminsights-overview.md) do not support the common schema.
2826
@@ -33,9 +31,10 @@ The common schema includes information about the affected resource and the cause
3331

3432
If you want to route alert instances to specific teams based on criteria such as a resource group, you can use the fields in the **Essentials** section to provide routing logic for all alert types. The teams that receive the alert notification can then use the context fields for their investigation.
3533
- **Alert context**: Fields that vary depending on the type of the alert. The alert context fields describe the cause of the alert. For example, a metric alert would have fields like the metric name and metric value in the alert context. An activity log alert would have information about the event that generated the alert.
36-
- **Custom Properties**: A “key: value” object, defined in the alert rule and added to the webhook notifications.
37-
If the custom properties are not set in the Alert rule, this field will be null. Note: today this is only supported for Metric Alerts other alert types will contain null in this field.
34+
- **Custom properties**: You can add more information to the alert payload by adding custom properties if you've configured action groups for a metric alert rule.
3835

36+
> [!NOTE]
37+
> Custom properties are currently only supported by metric alerts. For all other alert types, the **custom properties** field is null.
3938
## Sample alert payload
4039

4140
```json
@@ -105,7 +104,7 @@ For sample alerts that use the common schema, see [Sample alert payloads](alerts
105104
| monitorCondition | When an alert fires, the alert's monitor condition is set to **Fired**. When the underlying condition that caused the alert to fire clears, the monitor condition is set to **Resolved**. |
106105
| monitoringService | The monitoring service or solution that generated the alert. The monitoring service determines which fields are in the alert context. |
107106
| alertTargetIds | The list of the Azure Resource Manager IDs that are affected targets of an alert. For a log alert defined on a Log Analytics workspace or Application Insights instance, it's the respective workspace or application. |
108-
| configurationItems |The list of affected resources of an alert.<br>In some cases, the configuration items can be different from the alert targets. For example, in metric-for-log or log alerts defined on a Log Analytics workspace, the configuration items are the actual resources sending the telemetry and not the workspace.<br><ul><li>In the log alerts API (Scheduled Query Rules) v2021-08-01, the `configurationItem` values are taken from explicitly defined dimensions in this priority: `Computer`, `_ResourceId`, `ResourceId`, `Resource`.</li><li>In earlier versions of the log alerts API, the `configurationItem` values are taken implicitly from the results in this priority: `Computer`, `_ResourceId`, `ResourceId`, `Resource`.</li></ul>In ITSM systems, the `configurationItems` field is used to correlate alerts to resources in a configuration management database. |
107+
| configurationItems |The list of affected resources of an alert.<br>In some cases, the configuration items can be different from the alert targets. For example, in metric-for-log or log alerts defined on a Log Analytics workspace, the configuration items are the actual resources sending the data, and not the workspace.<br><ul><li>In the log alerts API (Scheduled Query Rules) v2021-08-01, the `configurationItem` values are taken from explicitly defined dimensions in this priority: `Computer`, `_ResourceId`, `ResourceId`, `Resource`.</li><li>In earlier versions of the log alerts API, the `configurationItem` values are taken implicitly from the results in this priority: `Computer`, `_ResourceId`, `ResourceId`, `Resource`.</li></ul>In ITSM systems, the `configurationItems` field is used to correlate alerts to resources in a configuration management database. |
109108
| originAlertId | The ID of the alert instance, as generated by the monitoring service generating it. |
110109
| firedDateTime | The date and time when the alert instance was fired in Coordinated Universal Time (UTC). |
111110
| resolvedDateTime | The date and time when the monitor condition for the alert instance is set to **Resolved** in UTC. Currently only applicable for metric alerts.|
@@ -124,7 +123,7 @@ For sample alerts that use the common schema, see [Sample alert payloads](alerts
124123
|windowSize |The time period analyzed by the alert rule.|
125124
|allOf |Indicates that all conditions defined in the alert rule must be met to trigger an alert.|
126125
|alertSensitivity |In an alert rule with a dynamic threshold, indicates how sensitive the rule is, or how much the value can deviate from the upper or lower threshold.|
127-
|failingPeriods |In an alert rule with a dynamic threshold, the number of evaluation periods that don't meet the alert threshold that will trigger an alert. For example, you can indicate that an alert is triggered when 3 out of the last five evaluation periods aren't within the alert thresholds. |
126+
|failingPeriods |In an alert rule with a dynamic threshold, the number of evaluation periods that don't meet the alert threshold that trigger an alert. For example, you can indicate that an alert is triggered when 3 out of the last five evaluation periods aren't within the alert thresholds. |
128127
|numberOfEvaluationPeriods|The total number of evaluations. |
129128
|minFailingPeriodsToAlert|The minimum number of evaluations that do no meet the alert rule conditions.|
130129
|ignoreDataBefore |(Optional.) In an alert rule with a dynamic threshold, the date from which the threshold is calculated. Use this value to indicate that the rule shouldn't calculate the dynamic threshold using data from before the specified date. |
@@ -140,6 +139,7 @@ For sample alerts that use the common schema, see [Sample alert payloads](alerts
140139
|webTestName |If the condition type is `webtest`, the name of the webtest. |
141140
|windowStartTime |The start time of the evaluation window in which the alert fired. |
142141
|windowEndTime |The end time of the evaluation window in which the alert fired. |
142+
|customProperties ||
143143

144144
### Sample metric alert with a static threshold when the monitoringService = `Platform`
145145

@@ -673,6 +673,16 @@ See [Azure Monitor managed service for Prometheus rule groups (preview)](../esse
673673
}
674674
}
675675
```
676+
## Custom properties fields
677+
678+
If you've configured action groups for a metric alert rule, you can add more information to the alert payload by adding custom properties.
679+
680+
The custom properties section contains “key: value” objects that are added to webhook notifications.
681+
682+
If custom properties aren't set in the alert rule, the field is null.
683+
684+
> [!NOTE]
685+
> Custom properties are currently only supported by metric alerts. For all other alert types, the **custom properties** field is null.
676686
## Enable the common alert schema
677687

678688
Use action groups in the Azure portal or use the REST API to enable the common alert schema. Schemas are defined at the action level. For example, you must separately enable the schema for an email action and a webhook action.

articles/azure-monitor/alerts/alerts-create-new-alert-rule.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ You create an alert rule by combining:
1717
- The signal or telemetry from the resource.
1818
- Conditions.
1919

20-
Then you define these elements for the resulting alert actions by using:
20+
You then define these elements for the resulting alert actions by using:
2121
- [Alert processing rules](alerts-action-rules.md)
2222
- [Action groups](./action-groups.md)
2323

24+
Alerts triggered by these alert rules contain a payload that uses the [common alert schema](alerts-common-schema.md).
2425
## Create a new alert rule in the Azure portal
2526

2627
1. In the [portal](https://portal.azure.com/), select **Monitor** > **Alerts**.

articles/azure-monitor/alerts/alerts-overview.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,15 @@ This diagram shows you how alerts work.
1818

1919
:::image type="content" source="media/alerts-overview/alerts.png" alt-text="Diagram that explains Azure Monitor alerts." lightbox="media/alerts-overview/alerts.png":::
2020

21-
An *alert rule* monitors your telemetry and captures a signal that indicates something is happening on the specified resource. The alert rule captures the signal and checks to see if the signal meets the criteria of the condition. If the conditions are met, an alert is triggered, which initiates the associated action group and updates the state of the alert.
21+
An *alert rule* monitors your data and captures a signal that indicates something is happening on the specified resource. The alert rule captures the signal and checks to see if the signal meets the criteria of the condition. If the conditions are met, an alert is triggered, which initiates the associated action group and updates the state of the alert.
2222

2323
An alert rule combines:
2424
- The resources to be monitored.
25-
- The signal or telemetry from the resource.
25+
- The signal or data from the resource.
2626
- Conditions.
2727

2828
If you're monitoring more than one resource, the condition is evaluated separately for each of the resources. Alerts are fired for each resource separately.
2929

30-
After an alert is triggered, the alert is made up of:
31-
- **Alert processing rules**: You can use these rules to apply processing on fired alerts. Alert processing rules modify the fired alerts as they're being fired. You can use alert processing rules to add or suppress action groups, apply filters, or have the rule processed on a predefined schedule.
3230
- **Action groups**: These groups can trigger notifications or an automated workflow to let users know that an alert has been triggered. Action groups can include:
3331
- Notification methods, such as email, SMS, and push notifications.
3432
- Automation runbooks.
@@ -40,9 +38,9 @@ After an alert is triggered, the alert is made up of:
4038
- Event hubs.
4139
- **Alert conditions**: These conditions are set by the system. When an alert fires, the alert's monitor condition is set to **fired**. After the underlying condition that caused the alert to fire clears, the monitor condition is set to **resolved**.
4240
- **User response**: The response is set by the user and doesn't change until the user changes it.
41+
- **Alert processing rules**: You can use alert processing rules to make modifications to triggered alerts as they're being fired. You can use alert processing rules to add or suppress action groups, apply filters, or have the rule processed on a predefined schedule.
4342

4443
You can see all alert instances in all your Azure resources generated in the last 30 days on the [Alerts page](alerts-page.md) in the Azure portal.
45-
4644
## Types of alerts
4745

4846
This table provides a brief description of each alert type. For more information about each alert type and how to choose which alert type best suits your needs, see [Types of Azure Monitor alerts](alerts-types.md).
@@ -54,15 +52,14 @@ This table provides a brief description of each alert type. For more information
5452
|[Activity log alerts](alerts-types.md#activity-log-alerts)|Activity log alerts are triggered when a new activity log event occurs that matches defined conditions. Resource Health alerts and Service Health alerts are activity log alerts that report on your service and resource health.|
5553
|[Smart detection alerts](alerts-types.md#smart-detection-alerts)|Smart detection on an Application Insights resource automatically warns you of potential performance problems and failure anomalies in your web application. You can migrate smart detection on your Application Insights resource to create alert rules for the different smart detection modules.|
5654
|[Prometheus alerts (preview)](alerts-types.md#prometheus-alerts-preview)|Prometheus alerts are used for alerting on the performance and health of Kubernetes clusters, including Azure Kubernetes Service (AKS). The alert rules are based on PromQL, which is an open-source query language.|
57-
5855
## Recommended alert rules
5956

6057
If you don't have alert rules defined for the selected resource, you can [enable recommended out-of-the-box alert rules in the Azure portal](alerts-manage-alert-rules.md#enable-recommended-alert-rules-in-the-azure-portal).
6158

6259
The system compiles a list of recommended alert rules based on:
6360

6461
- The resource provider’s knowledge of important signals and thresholds for monitoring the resource.
65-
- Telemetry that tells us what customers commonly alert on for this resource.
62+
- Data that tells us what customers commonly alert on for this resource.
6663

6764
> [!NOTE]
6865
> Recommended alert rules is enabled for:
@@ -102,7 +99,6 @@ You can configure whether log or metric alerts are stateful or stateless. Activi
10299
|Log alerts| The alert condition isn't met for a specific time range. The time range differs based on the frequency of the alert:<ul> <li>**1 minute**: The alert condition isn't met for 10 minutes.</li> <li>**5 to 15 minutes**: The alert condition isn't met for three frequency periods.</li> <li>**15 minutes to 11 hours**: The alert condition isn't met for two frequency periods.</li> <li>**11 to 12 hours**: The alert condition isn't met for one frequency period.</li></ul>|
103100

104101
When an alert is considered resolved, the alert rule sends out a resolved notification by using webhooks or email. The monitor state in the Azure portal is set to **resolved**.
105-
106102
## Pricing
107103
For information about pricing, see [Azure Monitor pricing](https://azure.microsoft.com/pricing/details/monitor/).
108104

articles/azure-monitor/alerts/alerts-payload-samples.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ The common schema includes information about the affected resource and the cause
1919

2020
If you want to route alert instances to specific teams based on criteria such as a resource group, you can use the fields in the **Essentials** section to provide routing logic for all alert types. The teams that receive the alert notification can then use the context fields for their investigation.
2121
- **Alert context**: Fields that vary depending on the type of the alert. The alert context fields describe the cause of the alert. For example, a metric alert would have fields like the metric name and metric value in the alert context. An activity log alert would have information about the event that generated the alert.
22+
- **Custom properties**: You can add more information to the alert payload by adding custom properties if you've configured action groups for a metric alert rule.
23+
24+
> [!NOTE]
25+
> Custom properties are currently only supported by metric alerts. For all other alert types, the **custom properties** field is null.
2226
2327
## Sample alert payload
2428

articles/azure-monitor/alerts/alerts-processing-rules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ms.reviewer: ofmanor
1515
> [!NOTE]
1616
> Alert processing rules were previously known as 'action rules'. For backward compatibility, the Azure resource type of these rules is still **Microsoft.AlertsManagement/actionRules** .
1717
18-
Alert processing rules allow you to apply processing on fired alerts. Alert processing rules are different from alert rules. Alert rules generate new alerts, while alert processing rules modify the fired alerts as they're being fired.
18+
Alert processing rules allow you to apply processing on fired alerts. Alert processing rules are different from alert rules. Alert rules generate new alerts, while alert processing rules modify the fired alerts as they're being fired.
1919

2020
You can use alert processing rules to add [action groups](./action-groups.md) or remove (suppress) action groups from your fired alerts. You can apply alert processing rules to different resource scopes, from a single resource, or to an entire subscription. You can also use them to apply various filters or have the rule work on a predefined schedule.
2121

0 commit comments

Comments
 (0)