alicloud_cms_site_monitor

更新时间:

This resource provides a site monitor resource and it can be used to monitor public endpoints and websites. Details at https://www.alibabacloud.com/help/doc-detail/67907.htm

-> NOTE: Available since v1.72.0.

Example Usage

Basic Usage


resource "alicloud_cms_site_monitor" "basic" {
  address   = "http://www.alibabacloud.com"
  task_name = "tf-example"
  task_type = "HTTP"
  interval  = 5
  isp_cities {
    city = "546"
    isp  = "465"
  }
  options_json = <<EOT
{
    "http_method": "get",
    "waitTime_after_completion": null,
    "ipv6_task": false,
    "diagnosis_ping": false,
    "diagnosis_mtr": false,
    "assertions": [
        {
            "operator": "lessThan",
            "type": "response_time",
            "target": 1000
        }
    ],
    "time_out": 30000
}
EOT
}

Argument Reference

The following arguments are supported:

  • address - (Required) The URL or IP address monitored by the site monitoring task.
  • task_name - (Required) The name of the site monitoring task. The name must be 4 to 100 characters in length. The name can contain the following types of characters: letters, digits, and underscores.
  • task_type - (Required, ForceNew) The protocol of the site monitoring task. Currently, site monitoring supports the following protocols: HTTP, PING, TCP, UDP, DNS, SMTP, POP3, and FTP.
  • alert_ids - (Optional, List) The IDs of existing alert rules to be associated with the site monitoring task.
  • interval - (Optional, Int) The monitoring interval of the site monitoring task. Unit: minutes. Valid values: 1, 5, 15, 30 and 60. Default value: 1. NOTE: From version 1.207.0, interval can be set to 30, 60.
  • options_json - (Optional) The extended options of the protocol of the site monitoring task. The options vary according to the protocol. See extended options.
  • isp_cities - (Optional, Set) The detection points in a JSON array. For example, [{"city":"546","isp":"465"},{"city":"572","isp":"465"},{"city":"738","isp":"465"}] indicates the detection points in Beijing, Hangzhou, and Qingdao respectively. You can call the DescribeSiteMonitorISPCityList operation to query detection point information. If this parameter is not specified, three detection points will be chosen randomly for monitoring. See isp_cities below.

isp_cities

The isp_cities supports the following:

  • city - (Required) The ID of the city.
  • isp - (Required) The ID of the carrier.

Attributes Reference

The following attributes are exported:

  • id - The ID of the site monitor rule.
  • task_state - The status of the site monitoring task.
  • create_time - The time when the site monitoring task was created.
  • update_time - The time when the site monitoring task was updated.

Timeouts

-> NOTE: Available since 1.207.0.

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

  • create - (Defaults to 5 mins) Used when create the Site Monitor.
  • update - (Defaults to 5 mins) Used when update the Site Monitor.
  • delete - (Defaults to 3 mins) Used when delete the Site Monitor.

Import

Cloud Monitor Service Site Monitor can be imported using the id, e.g.

$ terraform import alicloud_cms_site_monitor.example <id>