Provides a Cloud Monitor Service Metric Rule Black List resource.
For information about Cloud Monitor Service Metric Rule Black List and how to use it, see What is Metric Rule Black List.
Basic Usage
variable "name" {
default = "tf-example"
}
data "alicloud_zones" "default" {
available_resource_creation = "Instance"
}
data "alicloud_instance_types" "default" {
availability_zone = data.alicloud_zones.default.zones.0.id
cpu_core_count = 1
memory_size = 2
}
data "alicloud_images" "default" {
name_regex = "^ubuntu_[0-9]+_[0-9]+_x64*"
owners = "system"
}
resource "alicloud_vpc" "default" {
vpc_name = var.name
cidr_block = "10.4.0.0/16"
}
resource "alicloud_vswitch" "default" {
vswitch_name = var.name
cidr_block = "10.4.0.0/24"
vpc_id = alicloud_vpc.default.id
zone_id = data.alicloud_zones.default.zones.0.id
}
resource "alicloud_security_group" "default" {
name = var.name
vpc_id = alicloud_vpc.default.id
}
resource "alicloud_instance" "default" {
availability_zone = data.alicloud_zones.default.zones.0.id
instance_name = var.name
image_id = data.alicloud_images.default.images.0.id
instance_type = data.alicloud_instance_types.default.instance_types.0.id
security_groups = [alicloud_security_group.default.id]
vswitch_id = alicloud_vswitch.default.id
}
resource "alicloud_cms_metric_rule_black_list" "default" {
instances = [
"{\"instancceId\":\"${alicloud_instance.default.id}\"}"
]
metrics {
metric_name = "disk_utilization"
}
category = "ecs"
enable_end_time = 1799443209000
namespace = "acs_ecs_dashboard"
enable_start_time = 1689243209000
metric_rule_black_list_name = var.name
}
The following arguments are supported:
category
- (Required) Cloud service classification. For example, Redis includes kvstore_standard, kvstore_sharding, and kvstore_splitrw.effective_time
- (Optional) The effective time range of the alert blacklist policy.enable_end_time
- (Optional) The start timestamp of the alert blacklist policy.Unit: milliseconds.enable_start_time
- (Optional) The end timestamp of the alert blacklist policy.Unit: milliseconds.instances
- (Required) The list of instances of cloud services specified in the alert blacklist policy.is_enable
- (Optional) The status of the alert blacklist policy. Value:-true: enabled.-false: disabled.metric_rule_black_list_name
- (Required, ForceNew) The name of the alert blacklist policy.metrics
- (Optional) Monitoring metrics in the instance. See metrics
below. namespace
- (Required, ForceNew) The data namespace of the cloud service.scope_type
- (Optional) The effective range of the alert blacklist policy. Value:-USER: The alert blacklist policy only takes effect in the current Alibaba cloud account.-GROUP: The alert blacklist policy takes effect in the specified application GROUP.scope_value
- (Optional) Application Group ID list. The format is JSON Array.> This parameter is displayed only when 'ScopeType' is 'GROUP.metrics
The metrics supports the following:
metric_name
- (Required) The name of the monitoring indicator.resource
- (Optional) The extended dimension information of the instance. For example, '{"device":"C:"}' indicates that the blacklist policy is applied to all C disks under the ECS instance.The following attributes are exported:
id
- The ID of the blacklist policy.metric_rule_black_list_id
- The ID of the blacklist policy.create_time
- The timestamp for creating an alert blacklist policy.Unit: milliseconds.update_time
- Modify the timestamp of the alert blacklist policy.Unit: milliseconds.The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 5 mins) Used when create the Metric Rule Black List.delete
- (Defaults to 1 mins) Used when delete the Metric Rule Black List.update
- (Defaults to 5 mins) Used when update the Metric Rule Black List.Cloud Monitor Service Metric Rule Black List can be imported using the id, e.g.
$terraform import alicloud_cms_metric_rule_black_list.example <id>