In addition to the preset alerting rule templates provided by the system, you can also create custom alerting rule templates based on your business requirements to quickly configure alerting rules for cloud services. This topic describes how to create a custom alerting rule template.
tip
[Beta · Apply for Trial]: This feature is currently in beta. If you want to use it, contact your account manager.
In addition to the preset alerting rule templates provided by Volcengine Managed Service for Prometheus (VMP), you can also create or import alerting rule templates. The following table describes main scenarios and descriptions.
Limits
- When you import a template, the template file can be up to 100 MB in size.
- You can import up to 3 templates at a time.
- When you import a native alerting rule template of Prometheus, VMP will convert the alert levels based on the value of the level parameter in labels of each alerting rule in the imported alerting rule template. The following table shows the conversion relationships.
tip
If the labels of an alerting rule in an imported template do not include the level parameter, the system will convert the alert level of the rule to P2 by default.
Custom alerting rule template
Manually create a template
- On the top navigation bar, select the target region.
- On the left navigation bar, click Alert center > Alerting rule template. Click the Custom template tab.
- Click Create manually to create a custom alerting rule template.
- Specify the basic information of the alerting rule template.
- Configure variables. Click Add variable to configure global variables in the alerting rule template. You can define variables in the alerting rule template and reference the variables when you create an alerting rule by using the template. The system automatically adds the variables as labels to the PromQL statement of the alerting rule.
- Configure rules. Click Add rule to configure the alerting rules in the alerting rule template.
- Click Submit to complete the configuration.
- On the top navigation bar, select the target region.
- On the left navigation bar, click Alert center > Alerting rule template. Click the Custom template tab.
- Click Import yaml file to import an alerting rule template.
- Specify the Alerting rule template type and Yaml import method and import or paste the Yaml file. Then, click Next step.
- Confirm that the variable configurations in the alerting rule template are correct. If necessary, you can click Add variable to add new alert variables.
- Confirm that the rule configurations in the alerting rule template are correct. If necessary, you can click Add rule to add new alerting rules.
- Click Submit to complete the configuration.
Create an alerting rule group by using a template
After you create an alerting rule template, click Apply template in the Actions column that corresponds to the template to create an alerting rule group based on the template. For the configuration method of the alerting rule group, refer to Creating an alerting rule group. In the Variable configuration section, you can select variables and variable values predefined in the template. After you select variables, the system will automatically add them to the alerting rule to form a complete PromQL statement for alerting.
After you create an alerting rule template, you can view the information about the template in the template list. The information includes the template name, ID, version, description, number of associated rule groups, and time.
You can perform the following operations on alerting rule templates:
- Click Edit in the Actions column to edit the template content.
- Click Export in the Actions column to export the YAML configuration file of the template.
- Click Delete in the Actions column to delete the template.
warning
- After an alerting rule template is associated with an alerting rule group, the template cannot be directly deleted. You need to first delete the associated alerting rule group before deleting the template.
- After an alerting rule template is associated with an alerting rule group, the configuration modification of variables and rules will be restricted.
- Variables: You cannot create variables or delete existing variables. You can only edit the query statements, default values, and match expressions of the variables.
- Rule: You cannot delete existing rules. You can only edit the rule name, description, and trigger condition. You can add new rules.