文档

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.

-> NOTE: Available since v1.104.0.

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:

  • rule_id - (Required, ForceNew) The ID of the alert rule.
  • group_id - (Required) The ID of the application group.
  • group_metric_rule_name - (Required) The name of the alert rule.
  • metric_name - (Required) The name of the metric.
  • namespace - (Required, ForceNew) The namespace of the service.
  • category - (Optional) The abbreviation of the service name.
  • contact_groups - (Optional) Alarm contact group.
  • dimensions - (Optional) The dimensions that specify the resources to be associated with the alert rule.
  • email_subject - (Optional) The subject of the alert notification email.
  • effective_interval - (Optional) The time period during which the alert rule is effective.
  • no_effective_interval - (Optional) The time period during which the alert rule is ineffective.
  • interval - (Optional, ForceNew) The interval at which Cloud Monitor checks whether the alert rule is triggered. Unit: seconds.
  • period - (Optional, Int) The aggregation period of the monitoring data. Unit: seconds. The value is an integral multiple of 60. Default value: 300.
  • silence_time - (Optional, Int) 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.
  • webhook - (Optional) The callback URL.
  • targets - (Optional, Set, Available since v1.189.0) The information about the resource for which alerts are triggered. See targets below.
  • escalations - (Required, Set) Alarm level. See escalations below.

targets

The targets supports the following:

  • id - (Optional) The ID of the resource for which alerts are triggered.
  • json_params - (Optional) The parameters of the alert callback. The parameters are in the JSON format.
  • level - (Optional) The level of the alert. Valid values: Critical, Warn, Info.
  • arn - (Optional) The Alibaba Cloud Resource Name (ARN) of the resource. -> NOTE: Currently, the Alibaba Cloud Resource Name (ARN) of the resource. To use, please submit an application.

escalations

The escalations supports the following:

  • critical - (Optional) The critical level. See critical below.
  • info - (Optional) The info level. See info below.
  • warn - (Optional) The warn level. See warn below.

escalations-critical

The critical supports the following:

  • comparison_operator - (Optional) The comparison operator of the threshold for critical-level alerts.
  • statistics - (Optional) The statistical aggregation method for critical-level alerts.
  • threshold - (Optional) The threshold for critical-level alerts.
  • times - (Optional, Int) The consecutive number of times for which the metric value is measured before a critical-level alert is triggered.

escalations-info

The info supports the following:

  • comparison_operator - (Optional) The comparison operator of the threshold for info-level alerts.
  • statistics - (Optional) The statistical aggregation method for info-level alerts.
  • threshold - (Optional) The threshold for info-level alerts.
  • times - (Optional, Int) The consecutive number of times for which the metric value is measured before a info-level alert is triggered.

escalations-warn

The warn supports the following:

  • comparison_operator - (Optional) The comparison operator of the threshold for warn-level alerts.
  • statistics - (Optional) The statistical aggregation method for warn-level alerts.
  • threshold - (Optional) The threshold for warn-level alerts.
  • times - (Optional, Intl) The consecutive number of times for which the metric value is measured before a warn-level alert is triggered.

Attributes Reference

The following attributes are exported:

  • id - The resource ID in terraform of Group Metric Rule. Its value is same as rule_id.
  • status - The status of Group Metric Rule.

Timeouts

-> NOTE: Available since v1.191.0.

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

  • create - (Defaults to 3 mins) Used when create the Group Metric Rule.
  • update - (Defaults to 3 mins) Used when update the Group Metric Rule.
  • delete - (Defaults to 3 mins) Used when delete the Group Metric Rule.

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>

  • 本页导读 (0)
文档反馈