Subscribe to event notifications

更新时间:
复制 MD 格式

Tair (Redis OSS-compatible) integrates with CloudMonitor, allowing you to subscribe to important system events like instance minor version update, instance failover, and instance migration. When an event meets your configured alert conditions, CloudMonitor automatically notifies the relevant alert contacts.

Background

CloudMonitor monitors Alibaba Cloud resources and internet applications. Its alerting service promptly notifies you of system exceptions, such as a product failure, so you can handle them automatically. This service provides two main notification methods:

  • Send alert notifications via text message, email, or DingTalk chatbots.

  • Push events to services like Message Service (MNS), Function Compute, Log Service, or a callback URL to automate exception handling for your business scenarios.

Procedure

  1. To start, create an alert contact and an alert contact group, then add the contact to the group. For more information, see Create an alert contact or alert contact group.

    If you have already created them, you can skip this step.

  2. Log on to the Cloud Monitor console.

  3. In the left-side navigation pane, choose Event Center > Event Subscription.

    Note

    You can also create a subscription policy from the System Event menu as follows:

    1. In the left-side navigation pane, choose Event Center > System Event.

    2. In the Welcome to the New Event Center section, click Create Now.

  4. On the Subscription Policy tab, click Create Subscription Policy.

  5. On the Create Subscription Policy page, configure the following parameters.

    • Name: Enter a name for the subscription policy.

    • Subscription Type: Select System Event. For a list of system events for ApsaraDB for Redis and Tair supported by CloudMonitor, see RedisEvent.

    • Subscription Scope: For Product, select KVStore for Redis. For Event Type, select Maintenance. For Event Name, select Instance_Failover. For Event Level, select Critical. Leave Application Group, Event Content, and Event Resources unconfigured. This subscribes you to the Instance_Failover system event for all Tair and Tair instances in your account.

    • Combined Noise Reduction: Use the default value.

    • Notification: Create a notification configuration. Use the default notification method for Custom Notification Method.

      In the notification settings, enter a name, set Notification Settings to Set Notification Group Directly, select an alert Contact Group, and then click OK.

      Note

      For more information about how to create a notification configuration, see Create a notification configuration policy.

      The system sends notifications based on the methods defined for the contacts in the alert contact group. For example, if an alert contact has a phone number and an email address configured, and Custom Notification Method uses the default notification method, the alert contact will only receive phone calls, text messages, and emails.

    • Push and Integration: No configuration is required.

      Note

      For more information about how to create a push channel, see Create a push channel.

  6. Click Submit.

  7. Debug the event subscription.

    1. On the Subscription Policy tab, click Debug Event Subscription.

    2. In the Create Event Debugging panel, set Product to KVStore for Redis and Name to Instance_Failover.

      The system automatically generates the debugging content in JSON format.

      View the sample code

      {
          "product": "Redis",
          "resourceId": "acs:redis:cn-shenzhen:1764984725705461:instance/<resource-id>",
          "level": "WARN",
          "instanceName": "instanceName",
          "regionId": "cn-hangzhou",
          "name": "Instance_Failover",
          "content": {
              "InstanceName": "r-w***gsw",
              "eventId": "f5f***321",
              "publishTime": "2024-02-26T08:17:17+08:00",
              "reason": "",
              "product": "Re***",
              "instanceComment": "rch***s-3",
              "instanceId": "r-w***gsw",
              "EventType": "Ins***nce",
              "extra": {
                  "nodeZh": "",
                  "impactZh": "实例***",
                  "reasonEn": "In***ce Fa***es(Pr***ry In***ce Una***ble)",
                  "eventTime": "2024-02-26T08:16:22+08:00",
                  "impactEn": "Tr***nt in***ce dis***ion",
                  "reasonZh": "实例异***可用)",
                  "nodeInfo": [],
                  "nodeEn": "",
                  "reasonCode": "Pla***ble"
              },
              "instanceType": "In***ce",
              "eventType": "Ins***nce",
              "Timestamp": "1708906637.742"
          },
          "status": "Executed"
      }
    3. Click OK.

      An Operation successful message appears. CloudMonitor then sends a test notification to the alert contacts using the methods defined in the policy.

API Reference

API

Description

PutEventRule

Creates or modifies an event-triggered alert rule.

References