alicloud_cms_group_metric_rule

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.

Example Usage

Basic Usage

variable "name" {
  default = "tf-example"
}

resource "alicloud_cms_alarm_contact_group" "default" {
  alarm_contact_group_name = var.name
  describe                 = var.name
}

resource "alicloud_cms_monitor_group" "default" {
  monitor_group_name = var.name
  contact_groups     = [alicloud_cms_alarm_contact_group.default.id]
}

resource "alicloud_cms_group_metric_rule" "this" {
  group_id               = alicloud_cms_monitor_group.default.id
  group_metric_rule_name = var.name
  category               = "ecs"
  metric_name            = "cpu_total"
  namespace              = "acs_ecs_dashboard"
  rule_id                = var.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
    }
  }
}

Argument Reference

The following arguments are supported:

targets

The targets supports the following:

escalations

The escalations supports the following:

escalations-critical

The critical supports the following:

escalations-info

The info supports the following:

escalations-warn

The warn supports the following:

Attributes Reference

The following attributes are exported:

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

Import

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

$ terraform import alicloud_cms_group_metric_rule.example <rule_id>