This topic describes how to integrate alerts from Simple Log Service with Alert Management in Application Real-Time Monitoring Service (ARMS).
Background
Alert Management integrates with Simple Log Service using webhooks, allowing you to manage alerts centrally.
You can integrate Simple Log Service with Alert Management in one of two ways:
-
Method 1 (Legacy): Integrate all alerts from a specific project in Simple Log Service into Alert Management. For more information, see Create an integration and connect to Simple Log Service.
-
Method 2 (Recommended): Integrate specific alerts from Simple Log Service into Alert Management. For more information, see Create an integration and connect to Simple Log Service and Integrate specific alert rules from Simple Log Service.
Create a Simple Log Service integration
-
Log on to the ARMS console. In the left-side navigation pane, choose .
-
On the Integrations page, click the Alert Integration tab and then click Log Service.
-
In the dialog box, enter a name and description for the integration, and specify the auto-recovery timeout for alert events.
NoteAutomatic recovery time after timeout: If an alert event is not triggered again within the specified period of time, the alert event is automatically cleared.
-
In the Projects Enabling Alert Events section, under All Projects, all your Simple Log Service projects are displayed. Select the projects whose alerts you want to integrate, click the
icon, and then click Save.NoteThis feature automatically iterates through all alert rules configured in the selected projects and adds the request URL for alerts as
https://alerts.aliyuncs.com/api/v1/events/{{token}}. The{{token}}variable is a key automatically generated when the integration is created.After the configuration is complete, you can view the created Simple Log Service integration on the Alert Integration tab. A record named Simple Log Service Integration appears in the integration list. Its status is Enabled and its activity is Ready. Click Copy next to the integration address to copy the integration key address. The Actions column supports operations such as Edit, Delete, and Disable.
Integrate specific Simple Log Service alert rules
Integrating specific alert rules requires an existing Simple Log Service integration.
-
On the Integrations page, on the Alert Integration tab, copy the integration URL of the target Simple Log Service integration.
-
Log on to the Simple Log Service console.
-
In the Project area, click the target project. In the left-side navigation pane, click the alert icon
. -
On the Alert Center page, choose . On the Webhook Integration page, click Create .
-
In the dialog box that appears, add the general webhook for ARMS Alert Management by setting the name to ARMS Alert Management, selecting General Webhook as the type, and configuring the other parameters as prompted on the interface.
-
On the Alert Center page, choose . In the Actions column of the target template, click Modify. In the dialog box that appears, click the WebHook-Custom tab, configure the message content, and then click Confirm.
{ "uid": "{{ alert.aliuid }}", "project": "{{ alert.project }}(https://sls.console.alibabacloud.com/#/project/{{ alert.project }}/categoryList)", "trigger": "{{ alert.alert_name }}", "condition": "{{ alert.condition }}", "context": {{ alert.results[0].raw_results | to_json | quote }}, "message": " [Uid] {{ alert.aliuid }}\n\n> [Project] [{{ alert.project }}](https://sls.console.alibabacloud.com/#/project/{{alert.project }}/categoryList)\n\n> [Trigger] {{ alert.alert_name }}\n\n> [Condition] {{ alert.alert_name }}\n\n> [Message] Notification content\n\n> [Context] {{ alert.results[0].raw_results | to_json | quote | removeprefix('"') | removesuffix('"') }}\n\n> [View details]({{ alert.query_url }})" } -
On the Alert Center page, click the Alert rules tab. In the Actions column of the target rule, click Edit. In the dialog box that appears, expand Advanced Settings. In the Output Target section, select SLS Notification. In the Alert Policy section, select Simple Mode. Configure the notification channel for the universal webhook as prompted, and then click OK.
Edit an integration
Alert Management provides preset field mappings between the Simple Log Service alert source and Alert Management. You can also add or modify the field mappings on the Edit Integration page as needed.
-
On the Alert Integration tab, find the integration that you want to manage and click Edit in the Actions column.
-
In the Event Mapping section, click Send Test Data.
-
In the Send Test Data dialog box, enter the alert content of a third-party alert source in the JSON format and click Send.
Note-
If the message Uploaded. No events are generated. Configure mappings based on the original data. appears, the fields of the alert source are not mapped to the fields of ARMS alert events. The data that is sent is displayed in the left-side box. This allows you to select the source fields when you configure mappings.
-
If the message Uploaded. appears, the alert content is reported to the Alert Event History page. For more information, see View alert event history.
-
-
In the Send Test Data dialog box, click Disable.
-
In the left part of the Event Mapping section, click the data records for which you want to configure mappings to view the details.
-
In the right part of the Event Mapping section, configure field mappings between the alert source and ARMS.
-
Optional:In the Select Root Node section, specify whether to enable batch processing.
If an array node exists in the alert data, you can specify the array node as the root node. The data that belongs to the root node is processed in batches.
After you select Use Batch Processing, select the array node to be batch processed as the root node.
NoteIf multiple array nodes exist in the alert data, you can select only one of the array nodes for batch processing.
-
Optional:Select Configure Alert Recovery Events and configure field conditions for clearing alerts.
After ARMS receives events, it searches for alerts that contain specified field values and clears these alerts. The field that you specify to clear alerts must be a field that is equivalent to the alert severity in the event. You cannot use the
$.severityfield to clear alerts. For example, if the field that you specify to clear alerts is{$.eventType ="resolved"}, the system automatically clears all alerts whose value of eventType is resolved in the integration. -
In the Map Source Fields to Target Fields section, map the fields of the alert source to the alert fields of ARMS.
Click the mapping icon to change the method for field mapping.
-
Direct: The specified field of the alert source is directly mapped to the specified alert field of ARMS.
-
Series: You can use delimiters to concatenate multiple fields of the alert source into one field, and then map this field to the specified alert field of ARMS. Only special characters can be used as delimiters.
-
Conditional: The specified alert source fields are mapped to the ARMS alert fields only when the field values meet the specified conditions.
-
Mapping table: The alert source severity is mapped to the ARMS alert severity. The mapping table contains only the severity field.
The following table describes the alert fields of ARMS.
Alert field
Description
alertname
The name of the custom alert.
severity
The severity level of the alert. You must configure mappings for this field. The mapping method must be set to Direct.
message
The description of the alert. The description is used as the content of the alert message. The description cannot exceed 15,000 characters in length.
value
The sample value of a metric.
imageUrl
The URL of the line chart that contains Grafana metrics. The URL is used to map the line chart.
check
The check item of the alert. Examples: CPU, JVM, Application Crash, and Deployment.
source
The source of the alert.
class
The type of the object that triggers the alert event, for example, host.
service
The source service of the alert. Example: Login Service.
startat
The timestamp that represents the start time of the event.
endat
The timestamp that represents the end time of the event.
generatorUrl
The URL of the event details.
-
-
-
Configure field deduplication for alert events.
To reduce duplicate data, the system uses relevant fields as the basis for deduplication. ARMS Alert Management allows you to preview the deduplication grouping results of historical event data that is displayed in the Event Mapping section. You can change the fields to be deduplicated.
NoteYou can configure deduplication only for events that are not cleared.
-
In the Event Deduplication section on the Integration Details page, select the fields that are used for deduplication.
If multiple events have the same value for a specified field, the events are merged into one alert notification.
-
Click Deduplication Test to preview the alert group after deduplication.
NoteThe deduplication test takes effect only on the latest 10 data records that are uploaded in the left part of the Event Mapping section.
-
-
After you configure the settings, click Save.
View the details about an alert event
-
In the left-side navigation pane of the ARMS console, choose .
-
On the Alert Event History page, click the name of the alert event to view the event details. For more information, see View alert event history.
Add projects to the integration
To add alerts from new projects to an existing Simple Log Service integration, follow these steps:
-
On the Integrations page, find the target Simple Log Service integration and choose in the Actions column.
-
In the dialog box that appears, select the projects from which you want to receive alerts, click the
icon, and then click Save.
Manage integrations
In the left-side navigation pane, choose . On the Alert Integration tab, you can perform the following operations on the integrations that you created:
-
View the details of an integration: Find the integration and then click the row. On the Integration Details page, view the integration details.
-
Update key: To modify the key for an integration, select in the Actions column for the target integration and click Confirm in the dialog box that appears.
ImportantAfter you update the key, re-add the project alert for Simple Log Service. For more information, see Add a product.
-
Modify an integration: Find the integration and then click Edit in the Actions column. On the Integration Details page, modify the integration information and then click Save.
-
Enable or disable an integration: Find the integration and then click Disable or Enable in the Actions column.
-
Delete an integration: Find the integration and then click Delete in the Actions column. In the message that appears, click OK.
-
Add an event processing flow to an integration: Find the integration and click Add Event Processing Flow in the Actions column. For more information, see Event processing flow.
-
Create a notification policy: Find the integration for which you want to create a notification policy, and click More in the Actions column. In the list that appears, click Create Notification Policy. For more information, see Notification policies.
What to do next
After you create a notification policy, the system generates alerts and sends alert notifications for reported alert events based on the notification policy that you created. For more information, see Notification policies. On the Alert Sending History page, you can view the alerts that are generated based on the configured notification policy. For more information, see View alert sending history.