MetricRuleTemplate

class MetricRuleTemplate : KotlinCustomResource

Provides a Cloud Monitor Service Metric Rule Template resource. For information about Cloud Monitor Service Metric Rule Template and how to use it, see What is Metric Rule Template.

NOTE: Available since v1.134.0.

Example Usage

Basic Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.cms.MetricRuleTemplate;
import com.pulumi.alicloud.cms.MetricRuleTemplateArgs;
import com.pulumi.alicloud.cms.inputs.MetricRuleTemplateAlertTemplateArgs;
import com.pulumi.alicloud.cms.inputs.MetricRuleTemplateAlertTemplateEscalationsArgs;
import com.pulumi.alicloud.cms.inputs.MetricRuleTemplateAlertTemplateEscalationsCriticalArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var config = ctx.config();
final var name = config.get("name").orElse("tf-example");
var example = new MetricRuleTemplate("example", MetricRuleTemplateArgs.builder()
.metricRuleTemplateName(name)
.alertTemplates(MetricRuleTemplateAlertTemplateArgs.builder()
.category("ecs")
.metricName("cpu_total")
.namespace("acs_ecs_dashboard")
.ruleName("tf_example")
.escalations(MetricRuleTemplateAlertTemplateEscalationsArgs.builder()
.critical(MetricRuleTemplateAlertTemplateEscalationsCriticalArgs.builder()
.comparisonOperator("GreaterThanThreshold")
.statistics("Average")
.threshold("90")
.times("3")
.build())
.build())
.build())
.build());
}
}

Import

Cloud Monitor Service Metric Rule Template can be imported using the id, e.g.

$ pulumi import alicloud:cms/metricRuleTemplate:MetricRuleTemplate example <id>

Properties

Link copied to clipboard

The details of alert rules that are generated based on the alert template. See alert_templates below.

Link copied to clipboard
val applyMode: Output<String>?

The mode in which the alert template is applied. Valid values:GROUP_INSTANCE_FIRSTor ALARM_TEMPLATE_FIRST. GROUP_INSTANCE_FIRST: The metrics in the application group take precedence. If a metric specified in the alert template does not exist in the application group, the system does not generate an alert rule for the metric based on the alert template. ALARM_TEMPLATE_FIRST: The metrics specified in the alert template take precedence. If a metric specified in the alert template does not exist in the application group, the system still generates an alert rule for the metric based on the alert template.

Link copied to clipboard
val description: Output<String>?

The description of the alert template.

Link copied to clipboard
val enableEndTime: Output<String>?

The end of the time period during which the alert rule is effective. Valid values: 00 to 23. The value 00 indicates 00:59 and the value 23 indicates 23:59.

Link copied to clipboard
val enableStartTime: Output<String>?

The beginning of the time period during which the alert rule is effective. Valid values: 00 to 23. The value 00 indicates 00:00 and the value 23 indicates 23:00.

Link copied to clipboard
val groupId: Output<String>?

The ID of the application group.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

The name of the alert template.

Link copied to clipboard
val notifyLevel: Output<String>?

The alert notification method. Valid values:Set the value to 4. The value 4 indicates that alert notifications are sent by using TradeManager and DingTalk chatbots.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val restVersion: Output<String>

The version of the alert template to be modified.

Link copied to clipboard
val silenceTime: Output<Int>?

The mute period during which notifications are not repeatedly sent for an alert.Valid values: 0 to 86400. Unit: seconds. Default value: 86400.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val webhook: Output<String>?

The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.