Alert rules use the data structures described below.
Alert
|
Field |
Type |
Required |
Description |
|
name |
String |
Yes |
Alert rule ID, displayed in the URL. |
|
displayName |
String |
Yes |
Alert rule name, displayed in the alert list. |
|
status |
String |
No |
The status of the alert rule. Valid values:
|
|
type |
String |
Yes |
Fixed value: Alert. |
|
description |
String |
No |
Compatibility field. Set to an empty string. |
|
schedule |
Schedule |
Yes |
The check frequency-related settings. For more information, see Schedule. |
|
configuration |
Configuration |
Yes |
The detailed settings of the alert rule. For more information, see Configuration. |
Schedule
|
Field |
Type |
Required |
Description |
|
type |
String |
Yes |
Check frequency type. Valid values:
|
|
interval |
String |
No |
The fixed interval. Examples: 5m and 1h. If you set type to FixedRate, you must configure interval. |
|
cronExpression |
String |
No |
Cron expression for minute-level intervals, based on the 24-hour clock. Example: If you set type to Cron, you must configure cronExpression. |
|
dayOfWeek |
Integer |
No |
The day of the week. Valid values: 0 to 6, which specify Sunday to Saturday. If you set type to Weekly, you must configure dayOfWeek. |
|
hour |
Integer |
No |
The hour. Valid values: 0 to 23, which specify each hour in a day. If you set type to Weekly or Daily, you must configure hour. |
|
runImmediately |
Boolean |
No |
Whether to run the rule immediately after creation. |
Configuration
|
Field |
Type |
Required |
Description |
|
version |
String |
Yes |
Fixed value: 2.0. |
|
type |
String |
Yes |
Fixed value: default. |
|
dashboard |
String |
No |
The alert history dashboard. Recommended value: internal-alert-analysis. |
|
queryList |
AlertQuery |
Yes |
The list of query statements. |
|
groupConfiguration |
GroupConfiguration |
Yes |
Group evaluation settings. GroupConfiguration. |
|
joinConfigurations |
[]JoinConfiguration |
No |
Set operation settings. JoinConfiguration.
|
|
severityConfigurations |
[]SeverityConfiguration |
Yes |
Trigger conditions. Specify at least one. SeverityConfigurations. |
|
labels |
[]Tag |
No |
Labels. Tag. |
|
annotations |
[]Tag |
No |
Annotations. Tag. |
|
autoAnnotation |
Boolean |
Yes |
Whether to auto-add annotations.
|
|
sendResolved |
Boolean |
No |
Whether to send a recovery alert when an alert is cleared.
|
|
threshold |
Integer |
Yes |
Consecutive trigger count threshold. An alert fires when the trigger condition is met this many consecutive times. The system does not count the number of times when the specified trigger condition is not met. |
|
noDataFire |
Boolean |
No |
Whether to trigger an alert on no data.
|
|
noDataSeverity |
Integer |
No |
Alert severity for no-data alerts. Alert severities. |
|
policyConfiguration |
PolicyConfiguration |
Yes |
Alert policy settings. PolicyConfiguration. |
|
tags |
[]String |
No |
The type of the custom alert rule. Note
This field is supported in SLS SDK for Java V0.6.74 and later. |
AlertQuery
|
Field |
Type |
Required |
Description |
|
storeType |
String |
Yes |
Query data source type. Valid values:
|
|
region |
String |
Yes |
The region of the project in which the query is performed.
|
|
project |
String |
Yes |
The project in which the query is performed.
|
|
store |
String |
Yes |
The Logstore, Metricstore, or resource data on which the query is performed.
|
|
roleArn |
String |
No |
Alibaba Cloud Resource Name (ARN) of the RAM role for data access. For more information, see Configure authorization for data monitoring across projects. |
|
query |
String |
Yes |
The query statement.
|
|
timeSpanType |
String |
No |
Time range type. Time ranges of query statements. If you set storeType to log or metric, you must configure timeSpanType. |
|
start |
String |
No |
The start time. If you set storeType to log or metric, you must configure start. |
|
end |
String |
No |
The end time. If you set storeType to log or metric, you must configure end. |
|
powerSqlMode |
String |
No |
Whether to enable Dedicated SQL. Valid values:
|
GroupConfiguration
|
Field |
Type |
Required |
Description |
|
type |
String |
Yes |
Group evaluation type. Valid values:
|
|
fields |
[]String |
No |
Field to group results by. If you set type to custom, you must configure fields. |
JoinConfiguration
|
Field |
Type |
Required |
Description |
|
type |
String |
Yes |
Set operation type. Valid values:
|
|
condition |
String |
No |
If you set type to inner_join, left_join, right_join, full_join, left_exclude, or right_exclude, you must configure condition. Example: |
SeverityConfiguration
|
Field |
Type |
Required |
Description |
|
severity |
Integer |
Yes |
Alert severity level. Alert severities. |
|
evalCondition |
ConditionConfiguration |
No |
The trigger condition. For more information, see Specify evaluate expressions. |
|
evalCondition.condition |
String |
Yes |
Data matching expression.
|
|
evalCondition.countCondition |
String |
Yes |
Expression to match the data entry count.
|
Tag
|
Field |
Type |
Required |
Description |
|
key |
String |
Yes |
The name of the field. |
|
value |
String |
Yes |
The value of the field. |
PolicyConfiguration
|
Field |
Type |
Required |
Description |
|
alertPolicyId |
String |
Yes |
Alert policy ID.
|
|
actionPolicyId |
String |
Yes |
Action policy ID. In advanced mode, if the alert policy does not use a dynamic action policy, set actionPolicyId to an empty string. |
|
repeatInterval |
String |
Yes |
The repeat interval. Examples: 5m and 1h. |
|
useDefault |
Boolean |
Yes |
Compatibility field. Set to false. |
Reference data
Alert severities
|
Alert severity |
Description |
|
Critical |
10 |
|
High |
8 |
|
Medium |
6 |
|
Low |
4 |
|
Report |
2 |
Time ranges of query statements
|
timeSpanType |
start |
end |
Description |
|
Custom |
-15m |
absolute |
A 15-minute period of the Time Frame type. |
|
Custom |
-100s |
-20s |
A period of the Relative type that starts at the previous 100 seconds and ends at the previous 20 seconds. |
|
Custom |
-60s |
now |
A 60-second period of the Relative type. |
|
Custom |
-120m |
Empty string |
A 120-minute period of the Relative type. |
|
Relative |
-100s |
-20s |
A period of the Relative type that starts at the previous 100 seconds and ends at the previous 20 seconds. |
|
Relative |
-60s |
now |
A 60-second period of the Relative type. |
|
Relative |
-120m |
Empty string |
A 120-minute period of the Relative type. |
|
Truncated |
-15m |
Arbitrary |
A 15-minute period of the Time Frame type. |
|
Today |
Arbitrary |
Arbitrary |
A period that starts from 00:00 on the current day and ends at the current time. |
|
Yesterday |
Arbitrary |
Arbitrary |
A period that starts from 00:00 on the previous day and ends at 00:00 on the current day. |