Cloud service events are status changes of cloud service resources. For example, an Elastic Compute Service (ECS) instance is restarted abnormally or released, a snapshot is created for an ECS instance, or O&M operations will be performed on an ECS instance. For more information, see Event monitoring overview. Operation Orchestration Service (OOS) supports O&M tasks triggered by cloud service events. In an event-triggered O&M task, you can specify a template to be executed when the specified event occurs. An event-triggered O&M task keeps running to listen to the specified cloud service events until you cancel the task.
To create an event-triggered O&M task, follow these steps:
- Set a trigger rule to monitor the cloud service event that you concern.
- Select a template to be executed.
- Set parameters for executing the template.
Set a trigger rule
Parameter | Required | Description |
---|---|---|
Product | Yes | The service to monitor. Select a service from the drop-down list. |
Event Name | Yes | The name of the cloud service event. You can select multiple events. For more information about the valid values, see Cloud service events. |
Region | No | The region of the event resources. You can select multiple regions. For more information about the valid values, see Regions and zones. |
Event Severity | No | The severity of the event. Valid values: Critical, Warning, and Information. |
Event Details Filtering Rule | No | The JSON text used to filter the details of cloud service events. |
Rules for filtering event details
{
"resourceId": "i-bp1ecr********5go2go",
"resourceType": "ALIYUN::ECS::Instance",
"state": "Running"
}
The resourceId field in the event details indicates the ID of the ECS instance whose status was changed. An ECS instance can be in the pending, starting, running, stopping, stopped, or deleted state.
Rules for filtering event details are also described in JSON texts. In such a rule, use a key in the event details and set the value to the corresponding value or values in the event details.For example, if you want to configure an O&M task that is triggered when an instance is stopped, set the rule as follows:
{
"state": "Stopped"
}
If you want to configure an O&M task that is triggered when the i-abcde instance is stopped or released, set the rule as follows:
{
"resourceId": "i-abcde",
"state": ["Stopped", "Deleted"]
}
A sample text of event details is shown on the right of the Event Details Filtering Rule field for reference.
Select a template to be executed
Set parameters for executing the template
To extract values from event message bodies, use jQuery expressions in the $.Parameter name format.Take the message body of notifications for ECS instance status changes as an example. You can use the $.content.resourceId
expression to extract the value of the resourceId parameter,and use the $.regionId
expression to extract the value of the regionId parameter.
The following table describes the parameters that can be extracted from all event message bodies.
Expression | Description | Example |
---|---|---|
$.id | The ID of the event. | 9435EAD6-3CF6-4494-8F7A-3A**77 |
$.eventTime | The time when the event occurred (UTC+8). | 20181226T220114.058+0800 |
$.level | The severity of the event. Valid values: INFO, WARN, and CRITICAL. | INFO |
$.name | The name of the event. | Instance:StateChange |
$.regionId | The ID of the region where the event occurred. For more information about the valid values, see Regions and zones. | cn-hangzhou |
$.product | The name of the cloud service. | ECS |
$.resourceId | The Alibaba Cloud Resource Name (ARN) of the resource. | acs:ecs:cn-hangzhou:169070**30:instance/i-bp1ecr**5go2go |
$.userId | The ID of the Alibaba Cloud account. | 169070**30 |
$.content.fieldName | The dimension of the event. | N/A |
The following figure shows an example of extracting values from an alert message body.
You can also set fixed parameter values for executing the template. The method is similar to that for common templates.