Configure monitoring and alerting

更新时间:
复制 MD 格式

Realtime Compute for Apache Flink supports monitoring and alerting services from CloudMonitor (a free service) or Application Real-Time Monitoring Service (ARMS). Configure metric alerts for jobs, event alerts for jobs, and alerts for workflows to promptly identify and handle exceptions. This topic describes how to configure monitoring and alerting using different monitoring services.

Limitations

  • Monitoring and alerting cannot be configured for Flink jobs submitted to a Session cluster at deployment.

  • Monitoring and alerting are not currently supported for batch jobs.

  • ARMS does not support workflow alerts. However, you can still configure them using CloudMonitor (a free service).

Configuration guide

Based on the monitoring service type used by your workspace (Check monitoring service type), choose the appropriate configuration method:

Switch monitoring service types

You can switch between monitoring service types to meet different business needs.

In the Management Console, in the Actions column for the target workspace, click More to switch to the other monitoring service type.

Note

Read the notes about switching service types carefully. You can proceed with the configuration only after you select the confirmation checkbox.

Configure monitoring and alerting using CloudMonitor

Metric alert configuration

Important

Only the Alibaba Cloud account that purchased the workspace, and the RAM users and RAM roles under that account with namespace permissions, can configure alerts in CloudMonitor.

  1. Log on to the Cloud Monitor console.

  2. In the navigation pane on the left, choose Alerts > Alert Rules.

  3. Click Create Alert Rule and configure the parameters.

  4. Parameter

    Description

    Product

    Realtime Compute for Apache Flink

    Resource Scope

    Select Instance. The alert rule applies to the specified workspace of Realtime Compute for Apache Flink.

    Associated Resources

    Click Add Instance, select the workspace in the target region (How do I view information such as the workspace ID?), and then click OK.

    Rule Description

    Click Add Rule > Simple Metric or Composite Metric to open the Set Rule Description panel.

    The panel includes multiple alert levels: Critical, Warn (notifies via SMS, email, and webhook), and Info (notifies via email and webhook). For each level, you can set a threshold condition. For example, the average value is >= a specified threshold for 3 consecutive periods, where 1 period = 1 minute.

    In the Dimension section, you can configure the namespace (Flink namespace name) and deploymentID (the deployment ID on the Deployment Details tab of the Flink job) to specify the jobs to monitor.

    Note
    • If the namespace and deploymentID drop-down lists are empty, you can enter the values manually.

    • If you leave these fields empty, all jobs in all namespaces are monitored.

    Note

Event alert configuration (including workflows)

Important

Only the Alibaba Cloud account that purchased the workspace, and the RAM users and RAM roles under that account with namespace permissions, can configure alerts or subscribe to events in CloudMonitor.

Job event alerts

Subscribe to system event alerts for jobs by configuring conditions. Batch configuration of event alerts is supported.

  1. Log on to the Cloud Monitor console.

  2. In the navigation pane on the left, choose Event Center > Event Subscription.

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

  4. On the Create Subscription Policy page, configure the parameters. For more information about the parameters, see Manage event subscriptions (recommended).

    • Subscription Type: System Event.

    • Product: Select Realtime Compute for Apache Flink.

    • Event Name: Supports Job Run Failed (not supported when using the ARMS monitoring service), Post-mortem Processing for ECS Downtime, and Impact of Proactive O&M on ECS events.

    • Event Content: You can specify jobs or configure batch alerts by entering the following Flink information in the event content.

      • Workspace ID: Configure event alerts for all jobs in all namespaces under the target workspace. To view the workspace ID, see How do I view information such as the workspace ID?.

      • Namespace Name: Configure event alerts for all jobs in the target namespace.

      • Deployment Job Name: Configure event alerts for specific jobs. Separate multiple job names with a comma (,). If there are jobs with the same name under your account, use the DeploymentID instead.

      • DeploymentID: Configure event alerts for specific jobs. Separate multiple IDs with a comma (,). You can find the ID on the Deployment Details tab of the Flink job page as the deployment ID.

    Note

    If you do not set Application Group, Event Content, or Event Resource, the subscription applies to all workspaces within your account.

Workflow event alerts

Subscribe to system event alerts for Flink workflows by configuring conditions. Batch configuration of event alerts is supported. For more information about workflows, see Manage workflows.

  1. Get the resource ID of the workflow node.

    1. Log on to the Cloud Monitor console.

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

    3. On the Event Monitoring tab, set Product to Realtime Compute for Apache Flink and Event Name to Workflow Task Status Change, and then click Search.

    4. Find the resource ID of the workflow node below.

      On the Event Monitoring page, select Realtime Compute for Apache Flink from the Product drop-down list. In the event list, find the record with the event name flink:Workflow:TaskStateChange Workflow Task Status Change. You can view the resource ID of the workflow node in the Resource column.

      The resource format is acs:flink:cn-hangzhou:<AlibabaCloudAccountId>:resourceId/workspaceId/<workspaceId-namespaceId>#workflowDefinitionName/<workflowDefinitionName>#taskDefinitionName/<taskDefinitionName>. You can also use this format to directly construct the resource ID for your workflow node.

      Parameter

      Description

      <AlibabaCloudAccountIdOfWorkspace>

      The Alibaba Cloud account ID that owns the Flink workspace.

      <workspaceId-namespaceId>

      A combination of the workspaceId and namespaceId, joined by a hyphen (-).

      workspaceId: The workspace ID. For more information, see Workspace management and operations.

      namespaceId: The namespace name.

      <workflowDefinitionName>

      The workflow name.

      <taskDefinitionName>

      The workflow node name.

      Note

      There is usually a delay of several minutes before workflow status change events appear in CloudMonitor.

  2. Subscribe to event notifications.

    1. In the navigation pane on the left, choose Event Center > Event Subscription.

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

    3. On the Create Subscription Policy page, set the parameters for the subscription policy. For more information about the parameters, see Manage event subscriptions (recommended).

      • Subscription Type: System Event.

      • Product: Select Realtime Compute for Apache Flink.

      • Event Name: Select Workflow Task Status Change.

      • Event Content: Supports entering parameters such as toState: FAILED (workflow failed), toState: SUCCESS (workflow succeeded), and fromState: SCHEDULED, toState: RUNNING (workflow state changed from scheduled to running).

      • Event Resource: Enter the workflow resource ID obtained in Step 1. Separate multiple IDs with a comma (,).

      • Event Type, Event Level, Application Group: Do not set any of these.

Configure monitoring and alerting using ARMS

Metric alert configuration

Note

Multi-metric monitoring in ARMS is only supported through custom PromQL. For a simpler configuration method, use CloudMonitor metric alert configuration.

Configure a single job (Management Console)

You can create a new alert rule for a target job, or you can create an alert rule template and then use it to create alerts for target jobs. This can speed up the configuration of monitoring and alerting.

Note

The Development Console only displays alert events from the last 48 hours. To view older alert events, go to Alert Management in the ARMS console.

  1. Go to the alert configuration page.

    1. Log on to the Management Console and click Console in the Actions column for the target workspace.

    2. On the O&M > Deployments page, click the name of the target job.

    3. Click the Alert Configuration tab.

  2. On the Alert Rules tab, choose Add Alert Rule > Custom Rule.

    You can also choose Add Alert Rule > Rule Template. By adding and using an alert template, you can create alert rules directly or with minor modifications, which speeds up the configuration process.

  3. Enter the alert rule information.

    Category

    Parameter

    Description

    Rule Details

    Rule Name

    Must start with a letter and can only contain lowercase letters, numbers, and underscores (_). The length is limited to 3 to 64 characters.

    Description

    A note about the rule.

    Content

    Configure the conditions that trigger an alert. The system compares the specified metric value with the threshold at a specified interval. If the result meets the condition, an alert is automatically triggered.

    • Metric:

      • Restart Count in 1 Minute: The number of times the Job Manager has restarted in 1 minute.

      • Checkpoint Count in 5 Minutes: The number of successful checkpoints in 5 minutes.

      • Emit Delay: The business latency, which is the time difference between when data is generated and when it leaves the Source operator. The unit is seconds.

        Important

        The data generation time depends on the timestamp recorded in the external system. If the external system does not have a timestamp, or if the timestamp is written incorrectly, the Emit Delay value will be inaccurate and will not reflect the true latency. Configure alerts with multiple metrics to determine the real event. For more information, see Recommended configuration examples and templates for monitoring and alerting.

      • IN RPS: The number of input records per second. The unit is records/second.

      • OUT RPS: The number of output records per second. The unit is records/second.

      • Source Idle Time: The time that the source has not processed data. The unit is milliseconds.

      • Job Failed: The job has failed.

    • Time Difference: The length of the historical data time window that the system queries backward for each check. The unit is minutes.

    • Operator: Supports >= and <=.

    • Threshold: The value to compare with the metric.

      • If you select the >= operator, the system uses the MAX value from the vertical axis. If the maximum value within the time difference is >= the threshold, the alert rule is triggered.

      • If you select the <= operator, the system uses the MIN value from the vertical axis. If the minimum value within the time difference is <= the threshold, the alert rule is triggered.

    For example, assume you are monitoring the "Checkpoint Count in 5 Minutes" metric. The time difference is set to 10 minutes, the threshold is 2, and the operator is "<=".

    Every minute, the system checks the historical data from the last 10 minutes. If it finds any 5-minute interval where the number of successful checkpoints was less than or equal to 2, it triggers an alert.

    Effective Period

    The time when the alert monitoring is active. You can specify it to be active only during the day (9:00 to 18:00). By default, it is active all day.

    Alert Frequency

    Send an alert only once within a continuous number of minutes. Supports 1 minute to 1440 minutes (24 hours).

    Notification Method

    Notification Method

    You can select multiple notification methods. The supported methods are:

    • DingTalk

    • Email

    • SMS

    • Webhook

    • Phone

      Ensure that the recipient's phone number has been verified. Otherwise, this method will not work. You can click Notification Contact Management below. If the Phone column for the target contact on the contact tab shows Not verified, click to complete the verification.

    Important
    • Ensure that you have created and added available notification contacts. Otherwise, the alert notification will fail. For example, if you select DingTalk as the notification method, select DingTalk and add a DingTalk notification contact of the DingTalk chatbot type.

    • For more information about the billing of alert management, see Billing of alerts.

    Notification Contact

    You can notify multiple contacts at the same time. You can select or search for contacts. Before selecting a contact, you must click Notification Contact Management on the right to create one. For more information, see Workspace management and operations.

    Alarm Noise Reduction

    Click Advanced Settings, then you can turn on the Alarm Noise Reduction switch.

    After you turn on alarm noise reduction, alerts will not be sent for scenarios where the job can recover quickly, such as short-term failovers triggered by cluster scheduling or automatic tuning. Alerts are sent only when the threshold conditions you set are met continuously.

    No Data Alarms

    Click Advanced Settings, then you can turn on the No Data Alarms switch and enter the continuous no-data time information.

    After you turn on this feature, the system monitors for scenarios where no monitoring data is reported. If no data is reported within the selected time period, an alert is triggered. No monitoring data is usually reported when the JobManager is abnormal, the job stops unexpectedly, or the reporting link is abnormal.

  4. Click OK.

    The saved alert rule is enabled by default and appears in the alert rule list. You can choose to stop, edit, or delete it.

Configure single or multiple jobs (ARMS console)

Important

If you change a job name in the Flink console, any alert rule configured in the ARMS console based on the original job name becomes invalid. You must reselect the renamed job and configure the alert for it to take effect.

  1. Log on to the Management Console.

  2. In the Actions column for the target workspace, choose More > Monitoring Metric Configuration to go to the ARMS console.

    The workspace name, workspace ID, and corresponding Prometheus instance name are displayed at the top.

    The navigation pane on the left includes Dashboard List, Service Discovery, Metric Management, Alert Rules, and Settings. The agent status is displayed in the upper right. On the Metrics tab of the Service Discovery page, you can filter metrics by job name, metric type, and other conditions. The metric list displays the metric name, job name, metric type, and other information.

  3. Click Alert Rules on the left to create an alert rule.

    • Check Type: Supports metric alerts through static thresholds and custom PromQL (excluding alert metrics already supported by Flink).

    • Filter Conditions: Batch alert configuration is supported. For Namespace, enter the namespace name. Selecting all indicates all namespaces in the workspace. For Deployment Job, enter the deployment ID of the target job in the namespace (found on the Deployment Details tab of the Flink job). Selecting all indicates all jobs in the namespace.

    For more information about configuration parameters, see Create a Prometheus alert rule. You can also create a Prometheus alert rule template. For more information, see Create a Prometheus alert rule template.

Event alert configuration

Only job failure events are supported. Configure this by selecting the Job Failed rule in the metric alert configuration. Other event alerts are not currently supported. You can configure them through the CloudMonitor event alert configuration.

FAQ

How to check the monitoring service type for a workspace

You select the monitoring service type when you activate the workspace. After activation, on the O&M > Deployments page, click the name of the target job. If there is an Alert Configuration tab, the workspace uses the pay-as-you-go Prometheus monitoring service (ARMS). If not, it uses the free monitoring service (CloudMonitor).

How to add a DingTalk chatbot for alerts in the Development Console

  1. Add a custom DingTalk chatbot and get its webhook address. For more information, see Add a custom DingTalk chatbot and get its webhook address.

    Important

    For Security Settings, you must select at least Custom Keywords, and at least one keyword must be set to alert to receive alert information.

  2. Add a notification contact.

    1. On the O&M > Deployments page, click the name of the target job, and then click the Alert Configuration tab.

    2. Choose Add Alert Rule > Custom Rule or Rule Template.

    3. On the Create Rule or Create Alert Rule Template page, click Notification Contact Management.

  3. On the DingTalk Chatbot tab, click Add DingTalk Chatbot.

    Enter the Name and Address of the DingTalk chatbot, and then click Submit.

  4. Return to the Create Rule or Create Alert Rule Template page from Step 2. Set Notification Method to DingTalk, and for Notification Contact, select the corresponding DingTalk chatbot.

    For descriptions of other parameters in the alert rule, see Configure a single job (Management Console).

  5. Click OK.

How to create a webhook in the Development Console

  1. On the Alert Template or Rule Information page, click Notification Contact Management.

  2. On the Webhook tab, click Create Webhook.

  3. On the Create Webhook page, enter the webhook information.

    Parameter

    Description

    Name

    Required. The webhook name.

    URL

    Required. The web service address.

    Headers

    Optional. The request header, used to store cookie and token information. The format is key: value.

    Note

    Ensure there is a space after the colon that separates the key and value.

    Params

    Optional. The request parameters. The format is key: value.

    Note

    Ensure there is a space after the colon that separates the key and value.

    Body

    Required. The request body, used to store POST parameters and data.

    You can use the $content placeholder in the Body string to output the alert content.

  4. Click OK.

How to add a Lark chatbot for alerts in the Development Console

  1. On the Alert Template or Rule Information page, click Notification Contact Management.

  2. On the Webhook tab, click Create Webhook.

  3. On the Create Webhook page, enter the webhook information.

    Parameter

    Description

    Name

    Required. The webhook name.

    URL

    Required. The web service address. For more information about the parameters, see Lark Custom Bot Guide to get the webhook address for the Lark chatbot.

    Headers

    Optional. The request header, used to store cookie and token information. The format is key: value.

    Example: Arms-Content-Type: json

    Content-Type: application/json

    Note

    Ensure there is a space after the colon that separates the key and value.

    Params

    Optional. The request parameters. The format is key: value.

    Note

    Ensure there is a space after the colon that separates the key and value.

    Body

    Required. The request body, used to store POST parameters and data.

    You can use the $content placeholder in the Body string to output the alert content.

    Example: {"msg_type":"text","content": {"text":"$content"}}

  4. Click OK.

Related documents