CreateAlertRule

Updated at:

Creates a custom monitoring alert rule.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

Name

string

Yes

The name of the custom rule.

xm_create_test

Owner

string

Yes

The Alibaba Cloud UID of the owner of the custom rule.

279114181****

Enabled

boolean

Yes

Specifies whether the alert rule is enabled.

true

TriggerCondition

object

Yes

The conditions that trigger the alert.

Type

string

No

The type of the trigger condition. The value is case-sensitive. Valid values:

  • Finished: Indicates that the instance is completed.

  • UnFinished: Indicates that the instance is not completed.

  • Error: Indicates that an error occurs on the instance.

  • CycleUnfinished: Indicates that the instance cycle is not completed.

  • Timeout: Indicates that the instance times out.

  • InstanceTransferComplete: Indicates that the task-to-instance transfer is completed.

  • InstanceTransferFluctuate: Indicates that the number of instances fluctuates.

  • ExhaustedError: Indicates that an error still occurs after automatic reruns.

  • InstanceKeyword: Indicates that the error instance contains a keyword.

  • InstanceErrorCount: Indicates the number of error instances.

  • InstanceErrorPercentage: Indicates the percentage of error instances.

Error

Extension

object

No

The extension information. Some trigger conditions require configuration.

Error

object

No

The alert configuration for error alerting.

StreamTaskIds

array

No

The IDs of the real-time computing tasks to be monitored.

integer

No

The ID of the real-time computing task.

123

AutoRerunAlertEnabled

boolean

No

Specifies whether to generate an alert when an offline task is automatically rerun due to a failure.

false

Timeout

object

No

The alert configuration for timeout alerting.

TimeoutInMinutes

integer

No

The timeout period in minutes. Valid values: 1 to 21600.

10

UnFinished

object

No

The settings for alerts when an instance has not finished.

UnFinishedTime

string

No

The deadline for completion in the hh:mm format. Valid values for hh: 0 to 47. Valid values for mm: 0 to 59.

30:00

CycleUnfinished

object

No

The settings for alerts when a cycle has not finished.

CycleAndTime

array<object>

No

The list of cycle and time configurations.

object

No

CycleId

integer

No

The cycle ID. Valid values: 1 to 288.

1

Time

string

No

The deadline in the hh:mm format. Valid values for hh: 0 to 47. Valid values for mm: 0 to 59.

12:00

InstanceErrorCount

object

No

The alert configuration for instance error count alerting.

Count

integer

No

The number of error instances. Valid values: 1 to 10000.

5

InstanceErrorPercentage

object

No

The alert configuration for instance error percentage alerting.

Percentage

integer

No

The percentage of error instances. Valid values: 1 to 100.

5

InstanceTransferFluctuate

object

No

The alert configuration for instance transfer fluctuation alerting.

Trend

string

No

The type of fluctuation in the number of transferred instances. Valid values:

  • abs: absolute value

  • increase: increase

  • decrease: decrease

abs

Percentage

integer

No

The percentage of fluctuation in the number of transferred instances. Valid values: 1 to 100.

10

Target

object

No

The monitored object.

Type

string

No

The type of the monitored object. Valid values:

  • Task: node

  • Baseline: baseline

  • Project: workspace

  • BizProcess: business flow

Task

Ids

array

No

The list of monitored object IDs.

integer

No

The ID of the monitored object.

123123

AllowTasks

array

No

The whitelist of monitored tasks.

integer

No

The ID of the task in the whitelist.

123

Notification

object

No

The alert notification configuration.

SilenceStartTime

string

No

The start time of the alert silence period in the 24-hour format HH:mm.

22:00

SilenceEndTime

string

No

The end time of the alert silence period in the 24-hour format HH:mm.

23:00

IntervalInMinutes

integer

No

The alert interval in minutes. Valid values: 5 to 10000.

30

Maximum

integer

No

The maximum number of alerts per calendar day. Valid values: 1 to 10000.

3

Channels

array

Yes

The list of alert channels.

string

No

The alert channel. Valid values:

  • Mail: email

  • Phone: phone call

  • Sms: text message

  • Dingding: DingTalk webhook

  • Feishu: Lark webhook

  • Weixin: WeCom webhook

  • Webhook: custom webhook

Sms

Receivers

array<object>

Yes

The alert recipients.

object

No

ReceiverType

string

No

The type of the alert recipient. Valid values:

  • AliUid: Alibaba Cloud UID

  • ShiftSchedule: shift schedule

  • TaskOwner: node owner, applicable to custom alerts and event alerts

  • Owner: owner, applicable to baseline alerts

  • WebhookUrl: custom webhook URL

  • DingdingUrl: DingTalk webhook URL

  • FeishuUrl: Lark webhook URL

  • WeixinUrl: WeCom webhook URL

TaskOwner

ReceiverValues

array

No

The values of the alert recipients.

string

No

The value of the alert recipient. If ReceiverType is set to AliUid, enter the Alibaba Cloud UID. If ReceiverType is set to ShiftSchedule, enter the shift schedule ID. If ReceiverType is set to WebhookUrl, DingdingUrl, FeishuUrl, or WeixinUrl, enter the corresponding URL.

123123123

Extension

string

No

The additional configuration required for the alert recipient. If ReceiverType is set to DingdingUrl, you can set this parameter to {"atAll":true} to @all.

{"atAll":true}

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The ID of the request. You can use the ID to locate logs and troubleshoot issues.

A6C6B486-E3A2-5D52-9E76-D9380485D946

Id

integer

The ID of the created alert rule. You can pass this ID to GetAlertRule to query the rule details.

123123

Examples

Success response

JSON format

{
  "RequestId": "A6C6B486-E3A2-5D52-9E76-D9380485D946\n",
  "Id": 123123
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.