System events represent changes in the status of cloud resources, such as abnormal ECS instance restarts, instance releases, snapshot completions, or scheduled O&M tasks. CloudOps Orchestration Service lets you create event-triggered O&M tasks that run a specified template when a system event occurs. Each task runs continuously and listens for new events until you cancel it.
To create an event-triggered task:
Set event matching rules
|
Field |
Required |
Description |
|
Product type |
Yes |
Select one product type from the drop-down list. |
|
Event name |
Yes |
Select one or more event names from Cloud product events. |
|
Region |
No |
The region of the associated resource. Select one or more from Regions and zones. |
|
Event level |
No |
Valid values: Critical, Warning, and Info. |
|
Event details matching rule |
No |
A JSON-formatted rule to match system event details. |

Event details matching rule
System event details are JSON-formatted, with fields that vary by event type. Use these fields to filter events. For example, an ECS lifecycle state change event has the following `content` format:
{
"resourceId": "i-bp1ecr********5go2go",
"resourceType": "ALIYUN::ECS::Instance",
"state": "Running"
}In this example, `resourceId` is the ECS instance ID. The `state` field can be Pending, Starting, Running, Stopping, Stopped, or Deleted.
The matching rule is also JSON-formatted. Keys must match the event detail fields, and values specify conditions. To match a stopped instance:
{
"state": "Stopped"
}To match instance i-abcde being stopped or released:
{
"resourceId": "i-abcde",
"state": ["Stopped", "Deleted"]
}
Refer to the sample event message body on the page. The `content` section contains the event details.
Select a template
Select the template to run when the event occurs.
Set runtime parameters for the template
Template parameters accept static values or dynamic values from the event message body. If you enter static values, the template is always executed with those parameters. For dynamic values, use jq expressions to fetch fields from the message body.
Prefix dynamic values with $ followed by a jq expression. For example, use $.content.resourceId to fetch the `resourceId` from an ECS lifecycle state change event, or $.regionId for the region ID.
The event message body contains these fields:
|
Fetch expression |
Description |
Example value |
|
$.id |
The event ID. |
9435EAD6-3CF6-4494-8F7A-3A**77 |
|
$.eventTime |
The time when the event occurred, in UTC+8. |
20181226T220114.058+0800 |
|
$.level |
The event level. Valid values: INFO, WARN, and CRITICAL |
INFO |
|
$.name |
The code of the event name. |
Instance:StateChange |
|
$.regionId |
The Alibaba Cloud region ID. Regions and zones. |
cn-hangzhou |
|
$.product |
The code of the product name. |
ECS |
|
$.resourceId |
The Alibaba Cloud Resource Name (ARN) of the resource. ARN is the Global Resource Descriptor of Alibaba Cloud. |
acs:ecs:cn-hangzhou:169070**30:instance/i-bp1ecr**5go2go |
|
$.userId |
The ID of the Alibaba Cloud account. |
169070**30 |
|
$.content.fieldName |
The value of the specified field from the event details. |
None |
Select parameters from the event message body:
For static values, set the parameters as you would for a regular template.