MetricRuleTemplateArgs

data class MetricRuleTemplateArgs(val alertTemplates: Output<List<MetricRuleTemplateAlertTemplateArgs>>? = null, val applyMode: Output<String>? = null, val description: Output<String>? = null, val enableEndTime: Output<String>? = null, val enableStartTime: Output<String>? = null, val groupId: Output<String>? = null, val metricRuleTemplateName: Output<String>? = null, val notifyLevel: Output<String>? = null, val restVersion: Output<String>? = null, val silenceTime: Output<Int>? = null, val webhook: Output<String>? = null) : ConvertibleToJava<MetricRuleTemplateArgs>

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>

Constructors

Link copied to clipboard
fun MetricRuleTemplateArgs(alertTemplates: Output<List<MetricRuleTemplateAlertTemplateArgs>>? = null, applyMode: Output<String>? = null, description: Output<String>? = null, enableEndTime: Output<String>? = null, enableStartTime: Output<String>? = null, groupId: Output<String>? = null, metricRuleTemplateName: Output<String>? = null, notifyLevel: Output<String>? = null, restVersion: Output<String>? = null, silenceTime: Output<Int>? = null, webhook: Output<String>? = null)

Functions

Link copied to clipboard
open override fun toJava(): MetricRuleTemplateArgs

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>? = null

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>? = null

The description of the alert template.

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

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>? = null

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>? = null

The ID of the application group.

Link copied to clipboard
val metricRuleTemplateName: Output<String>? = null

The name of the alert template.

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

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 restVersion: Output<String>? = null

The version of the alert template to be modified.

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

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 webhook: Output<String>? = null

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