SNS Text Template

An SNS text template is a text template that is used when an alarm or event sends messages to an SNS topic.
  • The Cloud contains a default template of an alarm message and a recovered message. If you do not create a template, the Cloud will use the default template.
  • You can create multiple message templates, but can only default one template. Specifically, when messages are sent, the default formatted message will be used.
  • With ${}, you can use variables provided by an alarm or event in the template.
  • Currently, an SNS text template supports four types of endpoint platform: email, DingTalk, Microsoft Teams, and short message service. If you use an SNS text template, formatted alarm messages will be sent to you via email, DingTalk, Microsoft Teams, or short messages.

Create SNS Text Template

In the navigation pane of the ZStack Private Cloud UI, choose Platform O&M > ZWatch > SNS Text Template. On the SNS Text Template page, click Create SNS Text Template. On the displayed Create SNS Text Template page, set the following parameters:
  • Name: Enter a name for the SNS text template.
  • Description: Optional. Enter a description for the SNS text template.
  • Platform Type: Select an endpoint platform type. Currently, an SNS text template supports four types of endpoint platform: email, DingTalk, Microsoft Teams, and short message service.
  • Alarm Type: Select an alarm type. Options: Resource Alarm | Event Alarm.
  • Alarm Message Text: Either customize an SNS text template or use the default template native to the Cloud.
    The following examples are the email or DingTalk template text:
    Alarm ${ALARM_NAME} status changes to ${ALARM_CURRENT_STATUS}
    
    Alarm details
    UUID: ${ALARM_UUID}
    Namespace: ${ALARM_NAMESPACE}
    Conditions: ${ALARM_METRIC} ${ALARM_COMPARISON_OPERATOR} ${ALARM_THRESHOLD}
    Duration: ${ALARM_DURATION} seconds
    Previous status: ${ALARM_PREVIOUS_STATUS}
    Current value: ${ALARM_CURRENT_VALUE}
    Tag: ${ALARM_LABELS.join(",")}
    Note: If you set an SNS text template in DingTalk, follow the Markdown syntax. Currently, DingTalk only supports a subset of Markdown syntax.
    The following examples are the Microsoft Teams template text:
    • Resource alarm:
      {
        "activityTitle": "Alarm ${ALARM_NAME} ${TITLE_ALARM_RESOURCE_NAME} status changes to ${ALARM_CURRENT_STATUS}",
        "facts": [
          {
            "name": "Alarm details",
            "value": null
          },
          {
            "name": "UUID",
            "value": "${ALARM_UUID}"
          },
          {
            "name": "Resource type",
            "value": "${ALARM_NAMESPACE}"
          },
          {
            "name": "Conditions",
            "value": "${ALARM_METRIC} ${ALARM_COMPARISON_OPERATOR} ${ALARM_THRESHOLD}"
          },
          {
            "name": "Duration",
            "value": "${ALARM_DURATION} seconds"
          },
          {
            "name": "Previous status",
            "value": "${ALARM_PREVIOUS_STATUS}"
          },
          {
            "name": "Current value",
            "value": "${ALARM_CURRENT_VALUE}"
          },
          {
            "name": "Alarm resource UUID",
            "value": "${ALARM_RESOURCE_ID}"
          },
          {
            "name": "Alarm time",
            "value": "${ALARM_TIME}"
          },
          {
            "name": "Alarm resource name",
            "value": "${ALARM_RESOURCE_NAME}"
          },
          {
            "name": "Alarm emergency level",
            "value": "${ALARM_EMERGENCY_LEVEL}"
          },
          {
            "name": "Label",
            "value": "${ALARM_LABELS.join(\",\")}"
          }
        ]
      }
    • Event alarm:
      {
        "activityTitle": "Event ${EVENT_NAME} occurred",
        "facts": [
          {
            "name": "Event details",
            "value": null
          },
          {
            "name": "Name",
            "value": "${EVENT_NAME}"
          },
          {
            "name": "Resource type",
            "value": "${EVENT_NAMESPACE}"
          },
          {
            "name": "Alarm emergency level",
            "value": "${EVENT_EMERGENCY_LEVEL}"
          },
          {
            "name": "Alarm resource UUID",
            "value": "${EVENT_RESOURCE_ID}"
          },
          {
            "name": "Alarm resource name",
            "value": "${EVENT_RESOURCE_NAME}"
          },
          {
            "name": "Event time",
            "value": "${EVENT_TIME}"
          },
          {
            "name": "Event subscription UUID",
            "value": "${EVENT_SUBSCRIPTION_UUID}"
          },
          {
            "name": "Error",
            "value": "${EVENT_ERROR}"
          }
        ]
      }
    Note: If you set an SNS text template in Microsoft Teams, follow the webhook syntax on the Microsoft Teams official website. For more information, see the Microsoft Teams official website.
    The following examples are the short message service template:
    • Resource alarm:
      Alarm:${ALARM_NAME}, Resource Name:${ALARM_RESOURCE_NAME}, Condition:${ALARM_CONDITION}, Current Value:${ALARM_CURRENT_VALUE}
    • Event alarm:
      Alarm:${EVENT_NAME}, Resource Name:${EVENT_RESOURCE_NAME}, Emergency Level:${EVENT_EMERGENCY_LEVEL}, Error:${EVENT_ERROR}
    Note: If you set an alarm message template in short message service, apply for a third-party SMS signature and a third-party SMS template in advance. To change the template, complete your application again on the third party.
  • Message restoring text: When any resource monitored by an alarm recovers from the alarm status, alarm recovered messages will be sent to all platforms that you selected for one time. You can customize recovered messages texts. An SNS text template in short message does not support recover messages.
  • Make default: If selected, the currently created SNS text template will be set as the default template.
You can create an SNS text template, as shown in Create SNS Text Template.
Figure 1. Create SNS Text Template




SNS Text Template Operations

You can perform the following operations on an SNS text template:
  • Create: Create an SNS text template.
  • Make default: Set the SNS text template that you selected as the system default template.
  • Cancel Default: Cancel the defaulted SNS text template that you set.
  • Delete: Delete an SNS text alarm.
  • Modify name and description: Change a name and description of the SNS text template.
  • Modify message content: Change the contents of the alarm message text and message restoring text.
  • Audit: Check related operations of this SNS text template.