Alert callback for a system event (legacy)

更新时间:
复制 MD 格式

Beyond phone call, SMS message, and email notifications, Cloud Monitor's alert callback feature lets you integrate alert events into your existing operations or messaging system.

Prerequisites

You must have a public URL for your operations or messaging system.

Background information

Note

The old system event alert rule feature is no longer updated and will be phased out. We recommend that you use the alert callback feature in event subscription. For more information, see Use an alert callback for a system event (recommended).

Cloud Monitor sends alert notifications to your URL as HTTP or HTTPS POST requests. Add the following IP address ranges to your firewall allowlist:

If an alert callback request fails, Cloud Monitor retries up to three times with a 5-second timeout per request.

Procedure

  1. Log on to the Cloud Monitor console.

  2. In the navigation pane, choose Event Center > System Event.

  3. On the Event Monitoring tab, click Old Event Alarm Rules in the upper-right corner.

  4. Find the alert rule that you want to modify and click Modify in the Actions column.

    Note

    You can also create a new alert rule for system events. For more information, see Create a system event alert rule.

  5. At the bottom of the Create/Modify Event-triggered Alert Rule panel, select the URL Callback checkbox.

  6. Set Request Method to POST and enter the URL for the alert callback.

    To test the callback URL, follow these steps:

    1. Click Test to the right of the callback URL.

    2. In the Webhook Test panel, set the language parameter to Simplified Chinese or English. Check the returned status code and results to verify or troubleshoot the URL's connectivity.

    3. Click Close.

  7. Click OK.

  8. Test the alert rule.

    1. Find the target alert rule, click the More icon in the Actions column, and then click Test.

    2. In the Create Event Test panel, select the event that you want to use for the test.

    3. Click OK.

      Cloud Monitor automatically sends a test alert notification to the specified alert contact.

Result

When an alert rule is triggered, Cloud Monitor sends an HTTP POST request to the specified URL. The request body contains the following parameters.

Parameter

Type

Description

traceId

String

The ID of the event that a cloud service reports to Cloud Monitor. You can use this ID to troubleshoot event-triggered alerts.

resourceId

String

The ID of the resource.

product

String

The name of the cloud service. For a list of cloud services that support system events, see System events of cloud services.

ver

String

The event version.

instanceName

String

The name of the resource instance.

level

String

The severity level of the event. Valid values:

  • CRITICAL

  • WARN

  • INFO

groupId

String

The ID of the application group.

eventTime

String

The UTC timestamp of when the event occurred, in ISO 8601 format: yyyyMMddTHHmmss.SSSZ.

userId

String

The ID of the current account.

content

String

The event content.

regionId

String

The region ID.

name

String

The name of the event. For the event names that are supported by each cloud service, see System events of cloud services.

ruleName

String

The name of the alert rule.

id

String

The event ID.

status

String

The status of the event. For the statuses of specific events, see System events of cloud services.

Sample POST request:

{
    "resourceId":"acs:ecs:cn-hangzhou:130013558060****:instance/i-j6c9pagb27uzlikj****",
    "product":"ECS",
    "ver":"1.0",
    "instanceName":"zabank-prd-infra-ZAGateway-service-0****",
    "level":"INFO",
    "groupId":"",
    "eventType":"StatusNotification",
    "userId":"130013558060****",
    "content":{
        "resourceId":"i-j6c9pagb27uzlikj****",
        "instanceName":"zabank-prd-infra-ZAGateway-service-0****",
        "instanceType":"ecs.c6e.large",
        "state":"Deleted",
        "privateIpAddress":"10.48.XX.XX",
        "resourceType":"ALIYUN::ECS::Instance"
    },
    "regionId":"cn-hangzhou",
    "eventTime":"20230217T103516.475+0800",
    "name":"Instance:StateChange",
    "ruleName":"ECS event alarm New",
    "id":"bd5f9913-ec1d-412b-ace3-7a3618d7****",
    "status":"Normal"
}

Related documents