A Prometheus integration in ARMS Alert Management receives alert events from self-managed Prometheus instances and routes them through the ARMS alerting pipeline. You can connect Prometheus instances managed by Prometheus-Operator or other self-managed deployments.
Background information
Open source Prometheus reports alerts to Alertmanager. Configure <alertmanager_config> in Prometheus.yaml to send alerts to ARMS Alert Management. For the configuration reference, see [alertmanager_config].
ARMS Alert Management provides an Alertmanager-compatible endpoint for open source Prometheus. When you create a Prometheus integration, ARMS Alert Management generates an integration address and a bearer token that your Prometheus instance uses to send alerts.
Prerequisites
Access to the ARMS console. You obtain the bearer token for authentication from the integration settings page after you create the integration.
For the Prometheus-Operator method:
kubectlinstalled and configured with access to your Kubernetes cluster.For other self-managed Prometheus instances: write access to the
prometheus.yamlconfiguration file on your Prometheus host.
Step 1: Create an integration and connect a self-managed Prometheus instance
Log on to the ARMS console. In the left-side navigation pane, choose .
In the New Prometheus Integration dialog box, enter the name and description of the Prometheus integration and the auto-recovery time of alert events, and then click Save.
3. Select the connection method based on your Prometheus deployment. If your Prometheus is deployed through Prometheus-Operator, select Prometheus instances managed by Prometheus-Operator. Otherwise, select Other Self-managed Prometheus Instances. Then click OK.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.
Prometheus instances managed by Prometheus-Operator
Create the arms-alertmanager-config.yaml file on your local machine, and then paste the following content into the file.
- scheme: https
bearer_token: ******
static_configs:
- targets: ['alerts.aliyuncs.com']Obtain the bearer_token value from the ARMS console after the integration is created. Replace ****** with the actual token.
Use the arms-alertmanager-config.yaml file to create a secret named arms-am-config.
kubectl create secret generic arms-am-config --from-file=arms-alertmanager-config.yamlCreate the prometheus-patch.yaml file on your local machine, and then paste the following content into the file.
spec:
additionalAlertManagerConfigs:
key: arms-alertmanager-config.yaml
name: arms-am-configRun the following command to get the Prometheus object.
kubectl get prometheusSample response:
NAME VERSION REPLICAS AGE
prometheus-operator-160879-prometheus v2.18.2 1 4d1hRun the following command to apply the prometheus-patch.yaml file to the Prometheus object. Replace
prometheus-operator-160879-prometheuswith the name returned in the previous step.
kubectl patch prometheus prometheus-operator-160879-prometheus --patch "$(cat prometheus-patch.yaml)" --type=mergeOther Self-managed Prometheus Instances
Modify the prometheus.yaml configuration file.
The following example applies to Prometheus 2.x. For the configuration formats of other versions, see Prometheus documentation.
alerting:
alertmanagers:
- api_version: v1
authorization:
type: Bearer
credentials: <bearer_token>
scheme: https
static_configs:
- targets: ["alerts.aliyuncs.com"]Obtain the bearer token from the ARMS console. Replace <bearer_token> with the actual token value.
In your browser, open the Prometheus configuration page and verify that the
alertingsection contains the Alertmanager configuration with the targetalerts.aliyuncs.com.
Integrate other Prometheus-compatible observability systems with ARMS Alert Management
Thanos uses the --alertmanagers.config parameter of the thanos rule command to specify the Alertmanager configuration file. Enter the integration address and token described in the preceding steps. For more information about the configuration, see Thanos documentation.
VictoriaMetric uses the -notifier.config parameter of the ./bin/vmalert command to specify the notifier configuration file. Enter the integration address and token described in the preceding steps. For more information about the configuration, see VictoriaMetric documentation.
(Optional) Edit the integration
ARMS Alert Management presets the field mappings between the self-managed Prometheus alert source and ARMS Alert Management. You can 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.
-
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.
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.
If multiple array nodes exist in the alert data, you can select only one of the array nodes for batch processing.
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.
You 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.
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.
To update the key of an integration, in the Actions column on the right side of the target integration, choose MoreUpdate Key. In the dialog box that appears, click Confirm.
After you update the key, reconfigure the self-managed Prometheus instance with the new key. For more information, see Configure Prometheus.
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.