GroupMetricRuleArgs

data class GroupMetricRuleArgs(val category: Output<String>? = null, val contactGroups: Output<String>? = null, val dimensions: Output<String>? = null, val effectiveInterval: Output<String>? = null, val emailSubject: Output<String>? = null, val escalations: Output<GroupMetricRuleEscalationsArgs>? = null, val groupId: Output<String>? = null, val groupMetricRuleName: Output<String>? = null, val interval: Output<String>? = null, val metricName: Output<String>? = null, val namespace: Output<String>? = null, val noEffectiveInterval: Output<String>? = null, val period: Output<Int>? = null, val ruleId: Output<String>? = null, val silenceTime: Output<Int>? = null, val targets: Output<List<GroupMetricRuleTargetArgs>>? = null, val webhook: Output<String>? = null) : ConvertibleToJava<GroupMetricRuleArgs>

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

NOTE: Available since v1.104.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 _default = new alicloud.cms.AlarmContactGroup("default", {
alarmContactGroupName: name,
describe: name,
});
const defaultMonitorGroup = new alicloud.cms.MonitorGroup("default", {
monitorGroupName: name,
contactGroups: [_default&#46;id],
});
const _this = new alicloud.cms.GroupMetricRule("this", {
groupId: defaultMonitorGroup.id,
groupMetricRuleName: name,
category: "ecs",
metricName: "cpu_total",
namespace: "acs_ecs_dashboard",
ruleId: name,
period: 60,
interval: "3600",
silenceTime: 85800,
noEffectiveInterval: "00:00-05:30",
webhook: "http://www.aliyun.com",
escalations: {
warn: {
comparisonOperator: "GreaterThanOrEqualToThreshold",
statistics: "Average",
threshold: "90",
times: 3,
},
info: {
comparisonOperator: "LessThanLastWeek",
statistics: "Average",
threshold: "90",
times: 5,
},
},
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tf-example"
default = alicloud.cms.AlarmContactGroup("default",
alarm_contact_group_name=name,
describe=name)
default_monitor_group = alicloud.cms.MonitorGroup("default",
monitor_group_name=name,
contact_groups=[default&#46;id])
this = alicloud.cms.GroupMetricRule("this",
group_id=default_monitor_group.id,
group_metric_rule_name=name,
category="ecs",
metric_name="cpu_total",
namespace="acs_ecs_dashboard",
rule_id=name,
period=60,
interval="3600",
silence_time=85800,
no_effective_interval="00:00-05:30",
webhook="http://www.aliyun.com",
escalations={
"warn": {
"comparison_operator": "GreaterThanOrEqualToThreshold",
"statistics": "Average",
"threshold": "90",
"times": 3,
},
"info": {
"comparison_operator": "LessThanLastWeek",
"statistics": "Average",
"threshold": "90",
"times": 5,
},
})
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 @default = new AliCloud.Cms.AlarmContactGroup("default", new()
{
AlarmContactGroupName = name,
Describe = name,
});
var defaultMonitorGroup = new AliCloud.Cms.MonitorGroup("default", new()
{
MonitorGroupName = name,
ContactGroups = new[]
{
@default.Id,
},
});
var @this = new AliCloud.Cms.GroupMetricRule("this", new()
{
GroupId = defaultMonitorGroup.Id,
GroupMetricRuleName = name,
Category = "ecs",
MetricName = "cpu_total",
Namespace = "acs_ecs_dashboard",
RuleId = name,
Period = 60,
Interval = "3600",
SilenceTime = 85800,
NoEffectiveInterval = "00:00-05:30",
Webhook = "http://www.aliyun.com",
Escalations = new AliCloud.Cms.Inputs.GroupMetricRuleEscalationsArgs
{
Warn = new AliCloud.Cms.Inputs.GroupMetricRuleEscalationsWarnArgs
{
ComparisonOperator = "GreaterThanOrEqualToThreshold",
Statistics = "Average",
Threshold = "90",
Times = 3,
},
Info = new AliCloud.Cms.Inputs.GroupMetricRuleEscalationsInfoArgs
{
ComparisonOperator = "LessThanLastWeek",
Statistics = "Average",
Threshold = "90",
Times = 5,
},
},
});
});
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
}
_default, err := cms.NewAlarmContactGroup(ctx, "default", &cms.AlarmContactGroupArgs{
AlarmContactGroupName: pulumi.String(name),
Describe: pulumi.String(name),
})
if err != nil {
return err
}
defaultMonitorGroup, err := cms.NewMonitorGroup(ctx, "default", &cms.MonitorGroupArgs{
MonitorGroupName: pulumi.String(name),
ContactGroups: pulumi.StringArray{
_default.ID(),
},
})
if err != nil {
return err
}
_, err = cms.NewGroupMetricRule(ctx, "this", &cms.GroupMetricRuleArgs{
GroupId: defaultMonitorGroup.ID(),
GroupMetricRuleName: pulumi.String(name),
Category: pulumi.String("ecs"),
MetricName: pulumi.String("cpu_total"),
Namespace: pulumi.String("acs_ecs_dashboard"),
RuleId: pulumi.String(name),
Period: pulumi.Int(60),
Interval: pulumi.String("3600"),
SilenceTime: pulumi.Int(85800),
NoEffectiveInterval: pulumi.String("00:00-05:30"),
Webhook: pulumi.String("http://www.aliyun.com"),
Escalations: &cms.GroupMetricRuleEscalationsArgs{
Warn: &cms.GroupMetricRuleEscalationsWarnArgs{
ComparisonOperator: pulumi.String("GreaterThanOrEqualToThreshold"),
Statistics: pulumi.String("Average"),
Threshold: pulumi.String("90"),
Times: pulumi.Int(3),
},
Info: &cms.GroupMetricRuleEscalationsInfoArgs{
ComparisonOperator: pulumi.String("LessThanLastWeek"),
Statistics: pulumi.String("Average"),
Threshold: pulumi.String("90"),
Times: pulumi.Int(5),
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.cms.AlarmContactGroup;
import com.pulumi.alicloud.cms.AlarmContactGroupArgs;
import com.pulumi.alicloud.cms.MonitorGroup;
import com.pulumi.alicloud.cms.MonitorGroupArgs;
import com.pulumi.alicloud.cms.GroupMetricRule;
import com.pulumi.alicloud.cms.GroupMetricRuleArgs;
import com.pulumi.alicloud.cms.inputs.GroupMetricRuleEscalationsArgs;
import com.pulumi.alicloud.cms.inputs.GroupMetricRuleEscalationsWarnArgs;
import com.pulumi.alicloud.cms.inputs.GroupMetricRuleEscalationsInfoArgs;
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 default_ = new AlarmContactGroup("default", AlarmContactGroupArgs.builder()
.alarmContactGroupName(name)
.describe(name)
.build());
var defaultMonitorGroup = new MonitorGroup("defaultMonitorGroup", MonitorGroupArgs.builder()
.monitorGroupName(name)
.contactGroups(default_.id())
.build());
var this_ = new GroupMetricRule("this", GroupMetricRuleArgs.builder()
.groupId(defaultMonitorGroup.id())
.groupMetricRuleName(name)
.category("ecs")
.metricName("cpu_total")
.namespace("acs_ecs_dashboard")
.ruleId(name)
.period("60")
.interval("3600")
.silenceTime(85800)
.noEffectiveInterval("00:00-05:30")
.webhook("http://www.aliyun.com")
.escalations(GroupMetricRuleEscalationsArgs.builder()
.warn(GroupMetricRuleEscalationsWarnArgs.builder()
.comparisonOperator("GreaterThanOrEqualToThreshold")
.statistics("Average")
.threshold("90")
.times(3)
.build())
.info(GroupMetricRuleEscalationsInfoArgs.builder()
.comparisonOperator("LessThanLastWeek")
.statistics("Average")
.threshold("90")
.times(5)
.build())
.build())
.build());
}
}
configuration:
name:
type: string
default: tf-example
resources:
default:
type: alicloud:cms:AlarmContactGroup
properties:
alarmContactGroupName: ${name}
describe: ${name}
defaultMonitorGroup:
type: alicloud:cms:MonitorGroup
name: default
properties:
monitorGroupName: ${name}
contactGroups:
- ${default.id}
this:
type: alicloud:cms:GroupMetricRule
properties:
groupId: ${defaultMonitorGroup.id}
groupMetricRuleName: ${name}
category: ecs
metricName: cpu_total
namespace: acs_ecs_dashboard
ruleId: ${name}
period: '60'
interval: '3600'
silenceTime: 85800
noEffectiveInterval: 00:00-05:30
webhook: http://www.aliyun.com
escalations:
warn:
comparisonOperator: GreaterThanOrEqualToThreshold
statistics: Average
threshold: '90'
times: 3
info:
comparisonOperator: LessThanLastWeek
statistics: Average
threshold: '90'
times: 5

Import

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

$ pulumi import alicloud:cms/groupMetricRule:GroupMetricRule example <rule_id>

Constructors

Link copied to clipboard
constructor(category: Output<String>? = null, contactGroups: Output<String>? = null, dimensions: Output<String>? = null, effectiveInterval: Output<String>? = null, emailSubject: Output<String>? = null, escalations: Output<GroupMetricRuleEscalationsArgs>? = null, groupId: Output<String>? = null, groupMetricRuleName: Output<String>? = null, interval: Output<String>? = null, metricName: Output<String>? = null, namespace: Output<String>? = null, noEffectiveInterval: Output<String>? = null, period: Output<Int>? = null, ruleId: Output<String>? = null, silenceTime: Output<Int>? = null, targets: Output<List<GroupMetricRuleTargetArgs>>? = null, webhook: Output<String>? = null)

Properties

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

The abbreviation of the service name.

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

Alarm contact group.

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

The dimensions that specify the resources to be associated with the alert rule.

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

The time period during which the alert rule is effective.

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

The subject of the alert notification email.

Link copied to clipboard

Alarm level. See escalations below.

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

The ID of the application group.

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

The name of the alert rule.

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

The interval at which Cloud Monitor checks whether the alert rule is triggered. Unit: seconds.

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

The name of the metric.

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

The namespace of the service.

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

The time period during which the alert rule is ineffective.

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

The aggregation period of the monitoring data. Unit: seconds. The value is an integral multiple of 60. Default value: 300.

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

The ID of the alert rule.

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

The mute period during which new alerts are not reported even if the alert trigger conditions are met. Unit: seconds. Default value: 86400, which is equivalent to one day.

Link copied to clipboard
val targets: Output<List<GroupMetricRuleTargetArgs>>? = null

The information about the resource for which alerts are triggered. See targets below.

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

The callback URL.

Functions

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