alicloud.cms.MetricRuleTemplate
Explore with Pulumi AI
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
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "tf-example";
const example = new alicloud.cms.MetricRuleTemplate("example", {
metricRuleTemplateName: name,
alertTemplates: [{
category: "ecs",
metricName: "cpu_total",
namespace: "acs_ecs_dashboard",
ruleName: "tf_example",
escalations: {
critical: {
comparisonOperator: "GreaterThanThreshold",
statistics: "Average",
threshold: "90",
times: "3",
},
},
}],
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tf-example"
example = alicloud.cms.MetricRuleTemplate("example",
metric_rule_template_name=name,
alert_templates=[alicloud.cms.MetricRuleTemplateAlertTemplateArgs(
category="ecs",
metric_name="cpu_total",
namespace="acs_ecs_dashboard",
rule_name="tf_example",
escalations=alicloud.cms.MetricRuleTemplateAlertTemplateEscalationsArgs(
critical=alicloud.cms.MetricRuleTemplateAlertTemplateEscalationsCriticalArgs(
comparison_operator="GreaterThanThreshold",
statistics="Average",
threshold="90",
times="3",
),
),
)])
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cms"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "tf-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_, err := cms.NewMetricRuleTemplate(ctx, "example", &cms.MetricRuleTemplateArgs{
MetricRuleTemplateName: pulumi.String(name),
AlertTemplates: cms.MetricRuleTemplateAlertTemplateArray{
&cms.MetricRuleTemplateAlertTemplateArgs{
Category: pulumi.String("ecs"),
MetricName: pulumi.String("cpu_total"),
Namespace: pulumi.String("acs_ecs_dashboard"),
RuleName: pulumi.String("tf_example"),
Escalations: &cms.MetricRuleTemplateAlertTemplateEscalationsArgs{
Critical: &cms.MetricRuleTemplateAlertTemplateEscalationsCriticalArgs{
ComparisonOperator: pulumi.String("GreaterThanThreshold"),
Statistics: pulumi.String("Average"),
Threshold: pulumi.String("90"),
Times: pulumi.String("3"),
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "tf-example";
var example = new AliCloud.Cms.MetricRuleTemplate("example", new()
{
MetricRuleTemplateName = name,
AlertTemplates = new[]
{
new AliCloud.Cms.Inputs.MetricRuleTemplateAlertTemplateArgs
{
Category = "ecs",
MetricName = "cpu_total",
Namespace = "acs_ecs_dashboard",
RuleName = "tf_example",
Escalations = new AliCloud.Cms.Inputs.MetricRuleTemplateAlertTemplateEscalationsArgs
{
Critical = new AliCloud.Cms.Inputs.MetricRuleTemplateAlertTemplateEscalationsCriticalArgs
{
ComparisonOperator = "GreaterThanThreshold",
Statistics = "Average",
Threshold = "90",
Times = "3",
},
},
},
},
});
});
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());
}
}
configuration:
name:
type: string
default: tf-example
resources:
example:
type: alicloud:cms:MetricRuleTemplate
properties:
metricRuleTemplateName: ${name}
alertTemplates:
- category: ecs
metricName: cpu_total
namespace: acs_ecs_dashboard
ruleName: tf_example
escalations:
critical:
comparisonOperator: GreaterThanThreshold
statistics: Average
threshold: '90'
times: '3'
Create MetricRuleTemplate Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new MetricRuleTemplate(name: string, args: MetricRuleTemplateArgs, opts?: CustomResourceOptions);
@overload
def MetricRuleTemplate(resource_name: str,
args: MetricRuleTemplateArgs,
opts: Optional[ResourceOptions] = None)
@overload
def MetricRuleTemplate(resource_name: str,
opts: Optional[ResourceOptions] = None,
metric_rule_template_name: Optional[str] = None,
alert_templates: Optional[Sequence[MetricRuleTemplateAlertTemplateArgs]] = None,
apply_mode: Optional[str] = None,
description: Optional[str] = None,
enable_end_time: Optional[str] = None,
enable_start_time: Optional[str] = None,
group_id: Optional[str] = None,
notify_level: Optional[str] = None,
rest_version: Optional[str] = None,
silence_time: Optional[int] = None,
webhook: Optional[str] = None)
func NewMetricRuleTemplate(ctx *Context, name string, args MetricRuleTemplateArgs, opts ...ResourceOption) (*MetricRuleTemplate, error)
public MetricRuleTemplate(string name, MetricRuleTemplateArgs args, CustomResourceOptions? opts = null)
public MetricRuleTemplate(String name, MetricRuleTemplateArgs args)
public MetricRuleTemplate(String name, MetricRuleTemplateArgs args, CustomResourceOptions options)
type: alicloud:cms:MetricRuleTemplate
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args MetricRuleTemplateArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args MetricRuleTemplateArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args MetricRuleTemplateArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args MetricRuleTemplateArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args MetricRuleTemplateArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var metricRuleTemplateResource = new AliCloud.Cms.MetricRuleTemplate("metricRuleTemplateResource", new()
{
MetricRuleTemplateName = "string",
AlertTemplates = new[]
{
new AliCloud.Cms.Inputs.MetricRuleTemplateAlertTemplateArgs
{
Category = "string",
MetricName = "string",
Namespace = "string",
RuleName = "string",
Escalations = new AliCloud.Cms.Inputs.MetricRuleTemplateAlertTemplateEscalationsArgs
{
Critical = new AliCloud.Cms.Inputs.MetricRuleTemplateAlertTemplateEscalationsCriticalArgs
{
ComparisonOperator = "string",
Statistics = "string",
Threshold = "string",
Times = "string",
},
Info = new AliCloud.Cms.Inputs.MetricRuleTemplateAlertTemplateEscalationsInfoArgs
{
ComparisonOperator = "string",
Statistics = "string",
Threshold = "string",
Times = "string",
},
Warn = new AliCloud.Cms.Inputs.MetricRuleTemplateAlertTemplateEscalationsWarnArgs
{
ComparisonOperator = "string",
Statistics = "string",
Threshold = "string",
Times = "string",
},
},
Webhook = "string",
},
},
ApplyMode = "string",
Description = "string",
EnableEndTime = "string",
EnableStartTime = "string",
GroupId = "string",
NotifyLevel = "string",
RestVersion = "string",
SilenceTime = 0,
Webhook = "string",
});
example, err := cms.NewMetricRuleTemplate(ctx, "metricRuleTemplateResource", &cms.MetricRuleTemplateArgs{
MetricRuleTemplateName: pulumi.String("string"),
AlertTemplates: cms.MetricRuleTemplateAlertTemplateArray{
&cms.MetricRuleTemplateAlertTemplateArgs{
Category: pulumi.String("string"),
MetricName: pulumi.String("string"),
Namespace: pulumi.String("string"),
RuleName: pulumi.String("string"),
Escalations: &cms.MetricRuleTemplateAlertTemplateEscalationsArgs{
Critical: &cms.MetricRuleTemplateAlertTemplateEscalationsCriticalArgs{
ComparisonOperator: pulumi.String("string"),
Statistics: pulumi.String("string"),
Threshold: pulumi.String("string"),
Times: pulumi.String("string"),
},
Info: &cms.MetricRuleTemplateAlertTemplateEscalationsInfoArgs{
ComparisonOperator: pulumi.String("string"),
Statistics: pulumi.String("string"),
Threshold: pulumi.String("string"),
Times: pulumi.String("string"),
},
Warn: &cms.MetricRuleTemplateAlertTemplateEscalationsWarnArgs{
ComparisonOperator: pulumi.String("string"),
Statistics: pulumi.String("string"),
Threshold: pulumi.String("string"),
Times: pulumi.String("string"),
},
},
Webhook: pulumi.String("string"),
},
},
ApplyMode: pulumi.String("string"),
Description: pulumi.String("string"),
EnableEndTime: pulumi.String("string"),
EnableStartTime: pulumi.String("string"),
GroupId: pulumi.String("string"),
NotifyLevel: pulumi.String("string"),
RestVersion: pulumi.String("string"),
SilenceTime: pulumi.Int(0),
Webhook: pulumi.String("string"),
})
var metricRuleTemplateResource = new MetricRuleTemplate("metricRuleTemplateResource", MetricRuleTemplateArgs.builder()
.metricRuleTemplateName("string")
.alertTemplates(MetricRuleTemplateAlertTemplateArgs.builder()
.category("string")
.metricName("string")
.namespace("string")
.ruleName("string")
.escalations(MetricRuleTemplateAlertTemplateEscalationsArgs.builder()
.critical(MetricRuleTemplateAlertTemplateEscalationsCriticalArgs.builder()
.comparisonOperator("string")
.statistics("string")
.threshold("string")
.times("string")
.build())
.info(MetricRuleTemplateAlertTemplateEscalationsInfoArgs.builder()
.comparisonOperator("string")
.statistics("string")
.threshold("string")
.times("string")
.build())
.warn(MetricRuleTemplateAlertTemplateEscalationsWarnArgs.builder()
.comparisonOperator("string")
.statistics("string")
.threshold("string")
.times("string")
.build())
.build())
.webhook("string")
.build())
.applyMode("string")
.description("string")
.enableEndTime("string")
.enableStartTime("string")
.groupId("string")
.notifyLevel("string")
.restVersion("string")
.silenceTime(0)
.webhook("string")
.build());
metric_rule_template_resource = alicloud.cms.MetricRuleTemplate("metricRuleTemplateResource",
metric_rule_template_name="string",
alert_templates=[alicloud.cms.MetricRuleTemplateAlertTemplateArgs(
category="string",
metric_name="string",
namespace="string",
rule_name="string",
escalations=alicloud.cms.MetricRuleTemplateAlertTemplateEscalationsArgs(
critical=alicloud.cms.MetricRuleTemplateAlertTemplateEscalationsCriticalArgs(
comparison_operator="string",
statistics="string",
threshold="string",
times="string",
),
info=alicloud.cms.MetricRuleTemplateAlertTemplateEscalationsInfoArgs(
comparison_operator="string",
statistics="string",
threshold="string",
times="string",
),
warn=alicloud.cms.MetricRuleTemplateAlertTemplateEscalationsWarnArgs(
comparison_operator="string",
statistics="string",
threshold="string",
times="string",
),
),
webhook="string",
)],
apply_mode="string",
description="string",
enable_end_time="string",
enable_start_time="string",
group_id="string",
notify_level="string",
rest_version="string",
silence_time=0,
webhook="string")
const metricRuleTemplateResource = new alicloud.cms.MetricRuleTemplate("metricRuleTemplateResource", {
metricRuleTemplateName: "string",
alertTemplates: [{
category: "string",
metricName: "string",
namespace: "string",
ruleName: "string",
escalations: {
critical: {
comparisonOperator: "string",
statistics: "string",
threshold: "string",
times: "string",
},
info: {
comparisonOperator: "string",
statistics: "string",
threshold: "string",
times: "string",
},
warn: {
comparisonOperator: "string",
statistics: "string",
threshold: "string",
times: "string",
},
},
webhook: "string",
}],
applyMode: "string",
description: "string",
enableEndTime: "string",
enableStartTime: "string",
groupId: "string",
notifyLevel: "string",
restVersion: "string",
silenceTime: 0,
webhook: "string",
});
type: alicloud:cms:MetricRuleTemplate
properties:
alertTemplates:
- category: string
escalations:
critical:
comparisonOperator: string
statistics: string
threshold: string
times: string
info:
comparisonOperator: string
statistics: string
threshold: string
times: string
warn:
comparisonOperator: string
statistics: string
threshold: string
times: string
metricName: string
namespace: string
ruleName: string
webhook: string
applyMode: string
description: string
enableEndTime: string
enableStartTime: string
groupId: string
metricRuleTemplateName: string
notifyLevel: string
restVersion: string
silenceTime: 0
webhook: string
MetricRuleTemplate Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The MetricRuleTemplate resource accepts the following input properties:
- Metric
Rule stringTemplate Name - The name of the alert template.
- Alert
Templates List<Pulumi.Ali Cloud. Cms. Inputs. Metric Rule Template Alert Template> - The details of alert rules that are generated based on the alert template. See
alert_templates
below. - Apply
Mode string - The mode in which the alert template is applied. Valid values:
GROUP_INSTANCE_FIRST
orALARM_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. - Description string
- The description of the alert template.
- Enable
End stringTime - 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.
- Enable
Start stringTime - 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.
- Group
Id string - The ID of the application group.
- Notify
Level 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.
- Rest
Version string The version of the alert template to be modified.
NOTE: The version changes with the number of times that the alert template is modified.
- Silence
Time int The mute period during which notifications are not repeatedly sent for an alert.Valid values: 0 to 86400. Unit: seconds. Default value:
86400
.NOTE: Only one alert notification is sent during each mute period even if the metric value exceeds the alert threshold several times.
- Webhook string
- The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
- Metric
Rule stringTemplate Name - The name of the alert template.
- Alert
Templates []MetricRule Template Alert Template Args - The details of alert rules that are generated based on the alert template. See
alert_templates
below. - Apply
Mode string - The mode in which the alert template is applied. Valid values:
GROUP_INSTANCE_FIRST
orALARM_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. - Description string
- The description of the alert template.
- Enable
End stringTime - 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.
- Enable
Start stringTime - 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.
- Group
Id string - The ID of the application group.
- Notify
Level 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.
- Rest
Version string The version of the alert template to be modified.
NOTE: The version changes with the number of times that the alert template is modified.
- Silence
Time int The mute period during which notifications are not repeatedly sent for an alert.Valid values: 0 to 86400. Unit: seconds. Default value:
86400
.NOTE: Only one alert notification is sent during each mute period even if the metric value exceeds the alert threshold several times.
- Webhook string
- The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
- metric
Rule StringTemplate Name - The name of the alert template.
- alert
Templates List<MetricRule Template Alert Template> - The details of alert rules that are generated based on the alert template. See
alert_templates
below. - apply
Mode String - The mode in which the alert template is applied. Valid values:
GROUP_INSTANCE_FIRST
orALARM_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. - description String
- The description of the alert template.
- enable
End StringTime - 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.
- enable
Start StringTime - 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.
- group
Id String - The ID of the application group.
- notify
Level 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.
- rest
Version String The version of the alert template to be modified.
NOTE: The version changes with the number of times that the alert template is modified.
- silence
Time Integer The mute period during which notifications are not repeatedly sent for an alert.Valid values: 0 to 86400. Unit: seconds. Default value:
86400
.NOTE: Only one alert notification is sent during each mute period even if the metric value exceeds the alert threshold several times.
- webhook String
- The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
- metric
Rule stringTemplate Name - The name of the alert template.
- alert
Templates MetricRule Template Alert Template[] - The details of alert rules that are generated based on the alert template. See
alert_templates
below. - apply
Mode string - The mode in which the alert template is applied. Valid values:
GROUP_INSTANCE_FIRST
orALARM_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. - description string
- The description of the alert template.
- enable
End stringTime - 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.
- enable
Start stringTime - 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.
- group
Id string - The ID of the application group.
- notify
Level 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.
- rest
Version string The version of the alert template to be modified.
NOTE: The version changes with the number of times that the alert template is modified.
- silence
Time number The mute period during which notifications are not repeatedly sent for an alert.Valid values: 0 to 86400. Unit: seconds. Default value:
86400
.NOTE: Only one alert notification is sent during each mute period even if the metric value exceeds the alert threshold several times.
- webhook string
- The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
- metric_
rule_ strtemplate_ name - The name of the alert template.
- alert_
templates Sequence[MetricRule Template Alert Template Args] - The details of alert rules that are generated based on the alert template. See
alert_templates
below. - apply_
mode str - The mode in which the alert template is applied. Valid values:
GROUP_INSTANCE_FIRST
orALARM_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. - description str
- The description of the alert template.
- enable_
end_ strtime - 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.
- enable_
start_ strtime - 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.
- group_
id str - The ID of the application group.
- notify_
level str - 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.
- rest_
version str The version of the alert template to be modified.
NOTE: The version changes with the number of times that the alert template is modified.
- silence_
time int The mute period during which notifications are not repeatedly sent for an alert.Valid values: 0 to 86400. Unit: seconds. Default value:
86400
.NOTE: Only one alert notification is sent during each mute period even if the metric value exceeds the alert threshold several times.
- webhook str
- The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
- metric
Rule StringTemplate Name - The name of the alert template.
- alert
Templates List<Property Map> - The details of alert rules that are generated based on the alert template. See
alert_templates
below. - apply
Mode String - The mode in which the alert template is applied. Valid values:
GROUP_INSTANCE_FIRST
orALARM_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. - description String
- The description of the alert template.
- enable
End StringTime - 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.
- enable
Start StringTime - 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.
- group
Id String - The ID of the application group.
- notify
Level 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.
- rest
Version String The version of the alert template to be modified.
NOTE: The version changes with the number of times that the alert template is modified.
- silence
Time Number The mute period during which notifications are not repeatedly sent for an alert.Valid values: 0 to 86400. Unit: seconds. Default value:
86400
.NOTE: Only one alert notification is sent during each mute period even if the metric value exceeds the alert threshold several times.
- webhook String
- The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
Outputs
All input properties are implicitly available as output properties. Additionally, the MetricRuleTemplate resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing MetricRuleTemplate Resource
Get an existing MetricRuleTemplate resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: MetricRuleTemplateState, opts?: CustomResourceOptions): MetricRuleTemplate
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
alert_templates: Optional[Sequence[MetricRuleTemplateAlertTemplateArgs]] = None,
apply_mode: Optional[str] = None,
description: Optional[str] = None,
enable_end_time: Optional[str] = None,
enable_start_time: Optional[str] = None,
group_id: Optional[str] = None,
metric_rule_template_name: Optional[str] = None,
notify_level: Optional[str] = None,
rest_version: Optional[str] = None,
silence_time: Optional[int] = None,
webhook: Optional[str] = None) -> MetricRuleTemplate
func GetMetricRuleTemplate(ctx *Context, name string, id IDInput, state *MetricRuleTemplateState, opts ...ResourceOption) (*MetricRuleTemplate, error)
public static MetricRuleTemplate Get(string name, Input<string> id, MetricRuleTemplateState? state, CustomResourceOptions? opts = null)
public static MetricRuleTemplate get(String name, Output<String> id, MetricRuleTemplateState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Alert
Templates List<Pulumi.Ali Cloud. Cms. Inputs. Metric Rule Template Alert Template> - The details of alert rules that are generated based on the alert template. See
alert_templates
below. - Apply
Mode string - The mode in which the alert template is applied. Valid values:
GROUP_INSTANCE_FIRST
orALARM_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. - Description string
- The description of the alert template.
- Enable
End stringTime - 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.
- Enable
Start stringTime - 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.
- Group
Id string - The ID of the application group.
- Metric
Rule stringTemplate Name - The name of the alert template.
- Notify
Level 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.
- Rest
Version string The version of the alert template to be modified.
NOTE: The version changes with the number of times that the alert template is modified.
- Silence
Time int The mute period during which notifications are not repeatedly sent for an alert.Valid values: 0 to 86400. Unit: seconds. Default value:
86400
.NOTE: Only one alert notification is sent during each mute period even if the metric value exceeds the alert threshold several times.
- Webhook string
- The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
- Alert
Templates []MetricRule Template Alert Template Args - The details of alert rules that are generated based on the alert template. See
alert_templates
below. - Apply
Mode string - The mode in which the alert template is applied. Valid values:
GROUP_INSTANCE_FIRST
orALARM_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. - Description string
- The description of the alert template.
- Enable
End stringTime - 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.
- Enable
Start stringTime - 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.
- Group
Id string - The ID of the application group.
- Metric
Rule stringTemplate Name - The name of the alert template.
- Notify
Level 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.
- Rest
Version string The version of the alert template to be modified.
NOTE: The version changes with the number of times that the alert template is modified.
- Silence
Time int The mute period during which notifications are not repeatedly sent for an alert.Valid values: 0 to 86400. Unit: seconds. Default value:
86400
.NOTE: Only one alert notification is sent during each mute period even if the metric value exceeds the alert threshold several times.
- Webhook string
- The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
- alert
Templates List<MetricRule Template Alert Template> - The details of alert rules that are generated based on the alert template. See
alert_templates
below. - apply
Mode String - The mode in which the alert template is applied. Valid values:
GROUP_INSTANCE_FIRST
orALARM_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. - description String
- The description of the alert template.
- enable
End StringTime - 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.
- enable
Start StringTime - 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.
- group
Id String - The ID of the application group.
- metric
Rule StringTemplate Name - The name of the alert template.
- notify
Level 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.
- rest
Version String The version of the alert template to be modified.
NOTE: The version changes with the number of times that the alert template is modified.
- silence
Time Integer The mute period during which notifications are not repeatedly sent for an alert.Valid values: 0 to 86400. Unit: seconds. Default value:
86400
.NOTE: Only one alert notification is sent during each mute period even if the metric value exceeds the alert threshold several times.
- webhook String
- The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
- alert
Templates MetricRule Template Alert Template[] - The details of alert rules that are generated based on the alert template. See
alert_templates
below. - apply
Mode string - The mode in which the alert template is applied. Valid values:
GROUP_INSTANCE_FIRST
orALARM_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. - description string
- The description of the alert template.
- enable
End stringTime - 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.
- enable
Start stringTime - 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.
- group
Id string - The ID of the application group.
- metric
Rule stringTemplate Name - The name of the alert template.
- notify
Level 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.
- rest
Version string The version of the alert template to be modified.
NOTE: The version changes with the number of times that the alert template is modified.
- silence
Time number The mute period during which notifications are not repeatedly sent for an alert.Valid values: 0 to 86400. Unit: seconds. Default value:
86400
.NOTE: Only one alert notification is sent during each mute period even if the metric value exceeds the alert threshold several times.
- webhook string
- The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
- alert_
templates Sequence[MetricRule Template Alert Template Args] - The details of alert rules that are generated based on the alert template. See
alert_templates
below. - apply_
mode str - The mode in which the alert template is applied. Valid values:
GROUP_INSTANCE_FIRST
orALARM_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. - description str
- The description of the alert template.
- enable_
end_ strtime - 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.
- enable_
start_ strtime - 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.
- group_
id str - The ID of the application group.
- metric_
rule_ strtemplate_ name - The name of the alert template.
- notify_
level str - 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.
- rest_
version str The version of the alert template to be modified.
NOTE: The version changes with the number of times that the alert template is modified.
- silence_
time int The mute period during which notifications are not repeatedly sent for an alert.Valid values: 0 to 86400. Unit: seconds. Default value:
86400
.NOTE: Only one alert notification is sent during each mute period even if the metric value exceeds the alert threshold several times.
- webhook str
- The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
- alert
Templates List<Property Map> - The details of alert rules that are generated based on the alert template. See
alert_templates
below. - apply
Mode String - The mode in which the alert template is applied. Valid values:
GROUP_INSTANCE_FIRST
orALARM_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. - description String
- The description of the alert template.
- enable
End StringTime - 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.
- enable
Start StringTime - 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.
- group
Id String - The ID of the application group.
- metric
Rule StringTemplate Name - The name of the alert template.
- notify
Level 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.
- rest
Version String The version of the alert template to be modified.
NOTE: The version changes with the number of times that the alert template is modified.
- silence
Time Number The mute period during which notifications are not repeatedly sent for an alert.Valid values: 0 to 86400. Unit: seconds. Default value:
86400
.NOTE: Only one alert notification is sent during each mute period even if the metric value exceeds the alert threshold several times.
- webhook String
- The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
Supporting Types
MetricRuleTemplateAlertTemplate, MetricRuleTemplateAlertTemplateArgs
- Category string
- The abbreviation of the service name. Valid values:
ecs
,rds
,ads
,slb
,vpc
,apigateway
,cdn
,cs
,dcdn
,ddos
,eip
,elasticsearch
,emr
,ess
,hbase
,iot_edge
,kvstore_sharding
,kvstore_splitrw
,kvstore_standard
,memcache
,mns
,mongodb
,mongodb_cluster
,mongodb_sharding
,mq_topic
,ocs
,opensearch
,oss
,polardb
,petadata
,scdn
,sharebandwidthpackages
,sls
,vpn
. - Metric
Name string The name of the metric.
NOTE: For more information, see DescribeMetricMetaList or Appendix 1: Metrics.
- Namespace string
The namespace of the service.
NOTE: For more information, see DescribeMetricMetaList or Appendix 1: Metrics.
- Rule
Name string - The name of the alert rule.
- Escalations
Pulumi.
Ali Cloud. Cms. Inputs. Metric Rule Template Alert Template Escalations - The information about the trigger condition based on the alert level. See
escalations
below. - Webhook string
- The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
- Category string
- The abbreviation of the service name. Valid values:
ecs
,rds
,ads
,slb
,vpc
,apigateway
,cdn
,cs
,dcdn
,ddos
,eip
,elasticsearch
,emr
,ess
,hbase
,iot_edge
,kvstore_sharding
,kvstore_splitrw
,kvstore_standard
,memcache
,mns
,mongodb
,mongodb_cluster
,mongodb_sharding
,mq_topic
,ocs
,opensearch
,oss
,polardb
,petadata
,scdn
,sharebandwidthpackages
,sls
,vpn
. - Metric
Name string The name of the metric.
NOTE: For more information, see DescribeMetricMetaList or Appendix 1: Metrics.
- Namespace string
The namespace of the service.
NOTE: For more information, see DescribeMetricMetaList or Appendix 1: Metrics.
- Rule
Name string - The name of the alert rule.
- Escalations
Metric
Rule Template Alert Template Escalations - The information about the trigger condition based on the alert level. See
escalations
below. - Webhook string
- The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
- category String
- The abbreviation of the service name. Valid values:
ecs
,rds
,ads
,slb
,vpc
,apigateway
,cdn
,cs
,dcdn
,ddos
,eip
,elasticsearch
,emr
,ess
,hbase
,iot_edge
,kvstore_sharding
,kvstore_splitrw
,kvstore_standard
,memcache
,mns
,mongodb
,mongodb_cluster
,mongodb_sharding
,mq_topic
,ocs
,opensearch
,oss
,polardb
,petadata
,scdn
,sharebandwidthpackages
,sls
,vpn
. - metric
Name String The name of the metric.
NOTE: For more information, see DescribeMetricMetaList or Appendix 1: Metrics.
- namespace String
The namespace of the service.
NOTE: For more information, see DescribeMetricMetaList or Appendix 1: Metrics.
- rule
Name String - The name of the alert rule.
- escalations
Metric
Rule Template Alert Template Escalations - The information about the trigger condition based on the alert level. See
escalations
below. - webhook String
- The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
- category string
- The abbreviation of the service name. Valid values:
ecs
,rds
,ads
,slb
,vpc
,apigateway
,cdn
,cs
,dcdn
,ddos
,eip
,elasticsearch
,emr
,ess
,hbase
,iot_edge
,kvstore_sharding
,kvstore_splitrw
,kvstore_standard
,memcache
,mns
,mongodb
,mongodb_cluster
,mongodb_sharding
,mq_topic
,ocs
,opensearch
,oss
,polardb
,petadata
,scdn
,sharebandwidthpackages
,sls
,vpn
. - metric
Name string The name of the metric.
NOTE: For more information, see DescribeMetricMetaList or Appendix 1: Metrics.
- namespace string
The namespace of the service.
NOTE: For more information, see DescribeMetricMetaList or Appendix 1: Metrics.
- rule
Name string - The name of the alert rule.
- escalations
Metric
Rule Template Alert Template Escalations - The information about the trigger condition based on the alert level. See
escalations
below. - webhook string
- The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
- category str
- The abbreviation of the service name. Valid values:
ecs
,rds
,ads
,slb
,vpc
,apigateway
,cdn
,cs
,dcdn
,ddos
,eip
,elasticsearch
,emr
,ess
,hbase
,iot_edge
,kvstore_sharding
,kvstore_splitrw
,kvstore_standard
,memcache
,mns
,mongodb
,mongodb_cluster
,mongodb_sharding
,mq_topic
,ocs
,opensearch
,oss
,polardb
,petadata
,scdn
,sharebandwidthpackages
,sls
,vpn
. - metric_
name str The name of the metric.
NOTE: For more information, see DescribeMetricMetaList or Appendix 1: Metrics.
- namespace str
The namespace of the service.
NOTE: For more information, see DescribeMetricMetaList or Appendix 1: Metrics.
- rule_
name str - The name of the alert rule.
- escalations
Metric
Rule Template Alert Template Escalations - The information about the trigger condition based on the alert level. See
escalations
below. - webhook str
- The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
- category String
- The abbreviation of the service name. Valid values:
ecs
,rds
,ads
,slb
,vpc
,apigateway
,cdn
,cs
,dcdn
,ddos
,eip
,elasticsearch
,emr
,ess
,hbase
,iot_edge
,kvstore_sharding
,kvstore_splitrw
,kvstore_standard
,memcache
,mns
,mongodb
,mongodb_cluster
,mongodb_sharding
,mq_topic
,ocs
,opensearch
,oss
,polardb
,petadata
,scdn
,sharebandwidthpackages
,sls
,vpn
. - metric
Name String The name of the metric.
NOTE: For more information, see DescribeMetricMetaList or Appendix 1: Metrics.
- namespace String
The namespace of the service.
NOTE: For more information, see DescribeMetricMetaList or Appendix 1: Metrics.
- rule
Name String - The name of the alert rule.
- escalations Property Map
- The information about the trigger condition based on the alert level. See
escalations
below. - webhook String
- The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
MetricRuleTemplateAlertTemplateEscalations, MetricRuleTemplateAlertTemplateEscalationsArgs
MetricRuleTemplateAlertTemplateEscalationsCritical, MetricRuleTemplateAlertTemplateEscalationsCriticalArgs
- Comparison
Operator string - Statistics string
- Threshold string
- Times string
- Comparison
Operator string - Statistics string
- Threshold string
- Times string
- comparison
Operator String - statistics String
- threshold String
- times String
- comparison
Operator string - statistics string
- threshold string
- times string
- comparison_
operator str - statistics str
- threshold str
- times str
- comparison
Operator String - statistics String
- threshold String
- times String
MetricRuleTemplateAlertTemplateEscalationsInfo, MetricRuleTemplateAlertTemplateEscalationsInfoArgs
- Comparison
Operator string - Statistics string
- Threshold string
- Times string
- Comparison
Operator string - Statistics string
- Threshold string
- Times string
- comparison
Operator String - statistics String
- threshold String
- times String
- comparison
Operator string - statistics string
- threshold string
- times string
- comparison_
operator str - statistics str
- threshold str
- times str
- comparison
Operator String - statistics String
- threshold String
- times String
MetricRuleTemplateAlertTemplateEscalationsWarn, MetricRuleTemplateAlertTemplateEscalationsWarnArgs
- Comparison
Operator string - Statistics string
- Threshold string
- Times string
- Comparison
Operator string - Statistics string
- Threshold string
- Times string
- comparison
Operator String - statistics String
- threshold String
- times String
- comparison
Operator string - statistics string
- threshold string
- times string
- comparison_
operator str - statistics str
- threshold str
- times str
- comparison
Operator String - statistics String
- threshold String
- times String
Import
Cloud Monitor Service Metric Rule Template can be imported using the id, e.g.
$ pulumi import alicloud:cms/metricRuleTemplate:MetricRuleTemplate example <id>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.